How can i change my dart-sdk on VSCode
The Dart Code
plugin has a setting dart.sdkPath
The location of the Dart SDK to use for analyzing and executing code. If blank, Dart Code will attempt to find it from the PATH environment variable. When editing a Flutter project, the version of Dart included in the Flutter SDK is used in preference.
There's also dart.sdkPaths
which allows quick switching between alternatives.
For Flutter projects, use dart.flutterSdkPath(s)
It's quite easy if you use VSCode:
- Clone flutter repo to a new folder:
mkdir ~/flutter_devcd ~/flutter_devgit clone https://github.com/flutter/flutter.git .
- Open your workspace preferences and update
dart.flutterSdkPath
setting:
"settings": { "dart.flutterSdkPath": "/Users/youruser/flutter_dev"}
- Restart VSCode and you're good to go.
See more info in Dart Code - Quickly Switching Between SDK Versions
I want to add one more things to @Andrey, you can use FVM to install as much as you want versions and channels, it's easy to install and manage versions. It hold all versions on your home directory, I think it's easier than managing with Git.