Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
maheshmnj opened this issue Aug 26, 2021 · 3 comments
Labels
in flutter Relates to running Flutter apps is enhancement
Milestone

Comments

@maheshmnj
Copy link

maheshmnj commented Aug 26, 2021

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
@DanTup DanTup added this to the v3.26.0 milestone Aug 26, 2021
@DanTup DanTup added the in flutter Relates to running Flutter apps label Aug 26, 2021
@DanTup DanTup 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 Aug 26, 2021
@DanTup
Copy link
Member

DanTup commented Aug 26, 2021

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

@DanTup DanTup closed this as completed in 17cb925 Aug 26, 2021
@maheshmnj
Copy link
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?

@DanTup
Copy link
Member

DanTup commented Aug 26, 2021

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
Labels
in flutter Relates to running Flutter apps is enhancement
Projects
None yet
Development

No branches or pull requests

2 participants