You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The extension selects the wrong flutter SDK. I expect my local checked out git version to be used.
To Reproduce
I can reproduce it as follows (locally on windows, my drive is E, probably works with C too):
Put a downloaded version from flutter SDK here: E:/flutter
Setup and clone a git version of the flutter SDK here: E:/flutter-git
Setup PATH, it should contain "E:/flutter-git/flutter/bin", NOT E:/flutter
I also have FLUTTER_ROOT setup, pointing to E:/flutter-git/flutter
Start visual studio code ==> Wrong SDK is used
Expected behavior
I would have expected that the version from E:/flutter-git is used, since the PATH variable points there.
Additional information
I worked around this as follows:
Since I have the FLUTTER_ROOT variable set locally, I moved the process.env.FLUTTER_ROOT to second position in
src\extension\sdk\utils.ts@246
Versions (please complete the following information):
If you run the Dart: Open Extension Log command it'll open a log file that shows all the places searched. My guess is that you have not run flutter packages get in your project using the Git version of Flutter, so it's picking up the one used (it reads the .packages/.dart_tool/package_config.json to ensure it uses the same version you've been using there). This is expected since that's the one the analyzer will be using.
If you want to override/easily switch SDKs within a workspace, you can use the dart.flutterSdkPath/dart.flutterSdkPaths settings.
My guess is that you have not run flutter packages get in your project using the Git version of Flutter, so it's picking up the one used (it reads the .packages/.dart_tool/package_config.json to ensure it uses the same version you've been using there). This is expected since that's the one the analyzer will be using.
That was the problem, I did not know that the extension uses these files.
If you want to override/easily switch SDKs within a workspace, you can use the dart.flutterSdkPath/dart.flutterSdkPaths settings.
Thanks, I have not seen that. Maybe this option should be added to the README.md or to https://dartcode.org/faq/ to be better visible. What do you think?
Activity
DanTup commentedon May 28, 2021
If you run the Dart: Open Extension Log command it'll open a log file that shows all the places searched. My guess is that you have not run
flutter packages getin your project using the Git version of Flutter, so it's picking up the one used (it reads the.packages/.dart_tool/package_config.jsonto ensure it uses the same version you've been using there). This is expected since that's the one the analyzer will be using.If you want to override/easily switch SDKs within a workspace, you can use the
dart.flutterSdkPath/dart.flutterSdkPathssettings.Hamdor commentedon May 29, 2021
That was the problem, I did not know that the extension uses these files.
Thanks, I have not seen that. Maybe this option should be added to the README.md or to https://dartcode.org/faq/ to be better visible. What do you think?
DanTup commentedon Jun 28, 2021
I updated the DAQ at https://dartcode.org/faq/ to have a little more detail on the search for SDKs. Thanks!