General Apporch is below
For exists project
such as change version from 3.7.10 to 3.7.12
$ fvm install 3.7.12
$ cd project
$ fvm use 3.7.12 -f
with command fvm use 3.7.12 -f
, the file .fvm/fvm_config.json
will update and the sybolink .fvm/flutter_sdk
also was updated to version 3.7.12.
{
"flutterSdkVersion": "3.7.10",
"flavors": {}
}
to
{
"flutterSdkVersion": "3.7.12",
"flavors": {}
}
.vscode/settings.json
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
}
cd to you project and use fvm use 3.7.12 -f
to change version.
For new project
To prevent compatibility issues with new version, may be create new project is best choice.
$ cd project
$ fvm use 3.7.12 -f
$ fvm flutter create --platforms=android --org com.xxx .
the command fvm use 3.7.12 -f
will create .fvm/flutter_sdk
and .fvm/fvm_config.json
file.
add .vscode/settings.json
to your project
Please read more detail with official website fvm
The following answers are only for the above questions
You can list all installed local sdk versions first. such as:
$ fvm list
Cache Directory: /Users/xxx/fvm/versions
3.10.0
3.7.12
- edit below user xxx to your's
{
"dart.flutterSdkPaths": ["/Users/xxx/fvm/versions"],
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
}
- Change Current Flutter SDK
open vscode command palette, the shortcuts is
Ctrl + Shift + p
for windows
Cmd + Shift + p
for macOS
input command Flutter: Change SDK
and select the command, this will be list all you have install sdks, select the one you wanted.
this will update the file .vscode/settings.json
{
"dart.flutterSdkPaths": ["/Users/xxx/fvm/versions"],
"dart.flutterSdkPath": "/Users/xxx/fvm/versions/3.7.12", // this is your select new version
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
}
don't forget remove the folder .fvm
, if you use this apporch.
$ rm -rf .fvm