Flutter version management in Visual Studio Code with FVM
What is FVM?#
Flutter Version Management (FVM) is a CLI utility that helps you work with multiple versions of the Flutter SDK.
If you are working on multiple Flutter projects, maybe some personal projects and some work projects, then FVM can save you time by seamlessly keeping each project pinned to a specific version of Flutter.
FVM can also help teams stay on the same Flutter version, preventing painful upgrade roll outs or dependency conflicts.
Use the steps below to install FVM and configure VS Code to work with it.
Install FVM#
In your terminal:
dart pub global activate fvm
Install a specific Flutter version#
In your terminal:
fvm install 2.2.1
Configure VS Code to use FVM#
In VS Code:
CMD + SHIFT + P
to open the Command Palette- Select
Preferences: Open Settings (JSON)
Add these options to your Settings JSON:
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
"dart.flutterSdkPaths": ["/Users/usr/fvm/versions"],
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
// ... other settings
}
Configure your Flutter project to a specific version#
fvm use 2.2.1
In VS Code:
CMD + SHIFT + P
to open the Command Palette- Select
Developer: Reload Window
You can always see the current version used by VS Code in the bottom right of the VS Code window. If you followed the steps above, you should see:
Flutter: 2.2.1
That's it! If you have questions, find me on Twitter @seanconnollydev.
Looking for help with a development or design project?
Reach out to work with me or other senior-level talent.
Contact me