Skip to content

[proposal] allow dart installation outside flutter folder and/or symlink #119331

Closed as not planned

Description

@iapicca

Description

in some case there is a pre-existing version of dart installed on the dev machine

to reproduce

  1. install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

it may throw right now, but works (see issue)

  1. install dart-sdk
brew install dart-sdk
  1. update path
export PATH="$PATH":"$HOME/.pub-cache/bin"
export PATH="$PATH":"$HOME/fvm/default/bin"
  1. install fvm
dart pub global activate fvm
  1. install flutter via fvm
fvm use stable
  1. run flutter doctor -v

expected result

before flutter 3.7, there was no warning

actual result

[!] Flutter (Channel stable, 3.7.0, on macOS 13.2 22D49 darwin-arm64, locale en-EE)
    • Flutter version 3.7.0 on channel stable at /Users/yakforward/fvm/versions/stable
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.19.0/libexec/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/yakforward/fvm/versions/stable. Consider adding
      /Users/yakforward/fvm/versions/stable/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (4 days ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to
      perform update checks and upgrades.

note

adding export PATH="$PATH":"$HOME/fvm/versions/stable/bin" to path
doesn't change the error message, there are just 2 darts now :)

Proposal

allow dart installation outside flutter folder
and possibly just symlink current dart version in the flutter folder if already exists and version matches

Activity

  1. added
    in triagePresently being triaged by the triage team
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: flutter doctorProblem related to the "flutter doctor" tool
    c: proposalA detailed proposal for a change to Flutter
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    on Jan 27, 2023
  2. exaby73 commented on Jan 27, 2023

    @exaby73
    Member

    Thanks I can reproduce this issue with 3.7. In fact, I've been living with it for a while since triaging requires me to mostly work on master :D

  3. removed
    in triagePresently being triaged by the triage team
    on Jan 27, 2023
  4. christopherfujino commented on Jan 27, 2023

    @christopherfujino
    Contributor

    adding export PATH="$PATH":"$HOME/fvm/versions/stable/bin" to path

    The doctor validator is suggesting export PATH="$HOME/fvm/versions/stable/bin:$PATH", not the other way around.

    Also, the doctor validator is not disallowing you to have multiple versions of Dart, it's just giving you a warning that, for example, calling dart format on your Flutter app code may not do what you think.

  5. iapicca commented on Jan 29, 2023

    @iapicca
    Author

    adding export PATH="$PATH":"$HOME/fvm/versions/stable/bin" to path

    The doctor validator is suggesting export PATH="$HOME/fvm/versions/stable/bin:$PATH", not the other way around.

    as I understand the warning

     ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.19.0/libexec/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/yakforward/fvm/versions/stable. Consider adding
          /Users/yakforward/fvm/versions/stable/bin to the front of your path.

    it sees my homebrew installation and asks me to
    "Consider adding /Users/yakforward/fvm/versions/stable/bin to the front of your path."
    which I did export PATH="$PATH":"$HOME/fvm/versions/stable/bin"
    with no changes in the message,
    so I assume that it is asking me to replace homebrew's dart with flutter's dart

    Also, the doctor validator is not disallowing you to have multiple versions of Dart, it's just giving you a warning that, for example, calling dart format on your Flutter app code may not do what you think.

    sure, no problem about that, I just wonder if it would be possible for flutter to
    "scan" the system for a dart installation and, if the installed version is compatible etc...,
    instead of make another copy, just use that one

  6. christopherfujino commented on Jan 30, 2023

    @christopherfujino
    Contributor

    adding export PATH="$PATH":"$HOME/fvm/versions/stable/bin" to path

    The doctor validator is suggesting export PATH="$HOME/fvm/versions/stable/bin:$PATH", not the other way around.

    as I understand the warning

     ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.19.0/libexec/bin/dart, which is not inside your
          current Flutter SDK checkout at /Users/yakforward/fvm/versions/stable. Consider adding
          /Users/yakforward/fvm/versions/stable/bin to the front of your path.
    

    it sees my homebrew installation and asks me to "Consider adding /Users/yakforward/fvm/versions/stable/bin to the front of your path." which I did export PATH="$PATH":"$HOME/fvm/versions/stable/bin" with no changes in the message, so I assume that it is asking me to replace homebrew's dart with flutter's dart

    Right, but by adding something to the END of your path when $PATH already contains dart, you're not changing anything :) (the $PATH variable is parsed from left to right, and then as soon as a match is found it stops searching).

    Also, the doctor validator is not disallowing you to have multiple versions of Dart, it's just giving you a warning that, for example, calling dart format on your Flutter app code may not do what you think.

    sure, no problem about that, I just wonder if it would be possible for flutter to "scan" the system for a dart installation and, if the installed version is compatible etc..., instead of make another copy, just use that one

    flutter already uses the right dart (there's a lot of complicated logic to find where you cloned the Flutter repo and then check inside its cache for the Dart SDK). This doctor validator is only warning you that invoking dart from the terminal on your app code may not do what you expect.

  7. christopherfujino commented on Feb 7, 2023

    @christopherfujino
    Contributor

    Closing as a duplicate of #115651

  8. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    on Feb 8, 2023
  9. github-actions commented on Mar 3, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: proposalA detailed proposal for a change to Flutterfound in release: 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: duplicateIssue is closed as a duplicate of an existing issuet: flutter doctorProblem related to the "flutter doctor" tooltoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions