1

I'm trying to have multiple flutter versions in MacOS, namely 2.0.4 & 3.7.1.

I have seen topics like this one VSCode: Quickly switch between flutter versions and followed tutorials like this one https://hackernoon.com/how-to-run-multiple-flutter-versions-on-macos-522x35ei but even after everything seems correctly defined, I'm stuck with the version 2.0.4, in the newest project.

1 - I have configured the $PATH permanently:

Old version 2.0.4

which flutter
/Users/MyUserName/Documents/flutter/bin/flutter

New version 3.7.1

which flutter371
/Users/MyUserName/Documents/flutter_3_7_1/bin/flutter371

2 - I have configured in VSCode the file /.vscode/settings.json like such: enter image description here

3 - I have configured directly into VSCode settings the Flutter SDK paths like such: enter image description here

Yet, when I click the in VSCode bottom navigation bar Flutter, it only shows this: enter image description here

What am I doing wrong?

Linesofcode
  • 5,327
  • 13
  • 62
  • 116
  • Could it be that by renaming the executable to flutter371, VSCode does not recognize the path "/Users/MyUserName/Documents/flutter_3_7_1" as a valid SDK anymore? – jraufeisen Feb 23 '23 at 15:54
  • Well, according to this tutorial https://hackernoon.com/how-to-run-multiple-flutter-versions-on-macos-522x35ei you can rename it as you wish, in that case, the person renamed it as `flutterstable`. But I'm gonna test `flutter` only. – Linesofcode Feb 23 '23 at 15:59
  • Yeah, didn't get any luck. Still the same problem. – Linesofcode Feb 23 '23 at 16:12
  • Show the JSON text of your settings instead of screenshots please. (see [ask] for why). – starball Feb 23 '23 at 19:45

1 Answers1

0

Could it be that by renaming the executable to flutter371

This is the problem. When VS Code searches for a Flutter SDK in the dart.flutterSdkPaths, it looks for a bin/flutter binary to ensure it's an SDK.

One way around this be to copy the file instead of renaming it, so it's still a valid Flutter SDK. You may need to ensure these folders are in the right order in your PATH environment variable if you want to mix it with another SDK though.

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275