Skip to content

Prompt to run "flutter pub get" if project references a different Flutter SDK to the one being used for analysis #3540

Closed

Description

@maheshj01

Is your feature request related to a problem? Please describe.

vscode supports adding multiple paths to flutter sdk, which allows us to switch between multiple versions of flutter and it works pretty well. I have set it up this way as answered in this stackoverflow thread but the problem is when we switch the version and when I look at the definition of any class, I see that it still points to the old SDK's code. The changes only gets reflected when we call flutter pub get

Describe the solution you'd like
So the solution I think is when we change the path to sdk the plugin should also call flutter pub get so that it points to correct class definitions.

Additional context

Heres a small demo describing the issue.

Screen.Recording.2021-08-26.at.7.37.05.AM.mov

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Aug 26, 2021
  2. added this to the v3.26.0 milestone on Aug 26, 2021
  3. changed the title [-]switching between multiple flutter sdks[/-] [+]Prompt to run "flutter pub get" if project references a different Flutter SDK to the one being used for analysis[/+] on Aug 26, 2021
  4. DanTup commented on Aug 26, 2021

    @DanTup
    Member

    I slightly generalised this - when checking at startup whether a project needs "pub get" running, we'll now also check whether it references the Flutter SDK, and if so, whether it's the same version we're using for analysis. This means we'll detect this mismatch even if you didn't just switch SDK (eg. you globally changed your Flutter SDK path with another project open, and then switched to this project).

    Aug-26-2021 09-54-37

  5. maheshj01 commented on Aug 26, 2021

    @maheshj01
    Author

    Thanks, that was so quick, Just curious will this change be available in the next upcoming plugin release or does the plugin get an update on each merge?

  6. DanTup commented on Aug 26, 2021

    @DanTup
    Member

    The plugin is updated approximately monthly. This change will be in the upcoming release, though you can grab the beta if you want to try it out sooner (if you install the beta, once the release is published, VS Code should automatically migrate you back to it):

    https://github.com/Dart-Code/Dart-Code/releases/tag/v3.26.0-beta.1

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

    in flutterRelates to running Flutter appsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions