Flutter version management or (FVM) is a tool to manage Flutter SDK Version on your machine. This means that we can define specific Flutter version for different projects.
This tool allows you to manage multiple channels and releases, and caches these versions locally, so you don’t have to wait for a full setup every time you want to switch versions.
1. Install FVM on your machine
- First make sure flutter is already installed. Moreover, it must be flutter stable channel. In your command line just simply type this:
// set flutter to stable channel
flutter channel stable// check flutter channel
flutter channel// output
- Once you have determined your flutter is already installed, Let install FVM by the following command:
flutter pub global activate fvm
- There is a warning message at the end of the installation process. So the next step would be to add
fvm pathto our shell’s config file (
bash_profile, etc.). In order for the
fvmcommand to work, it is necessary that you have three following lines defined within the file:
fvmin your command line to see all available options:
2. Install Flutter SDK Version with FVM
fvm install stableto install stable channel.
- If you want to see all flutter SDK version releases that you can install just type
- If you want to install specific version. Let say you want to install flutter SDK version 2.05 just type
fvm install 2.0.5
- To see your installed versions. just type:
3. Use FVM in your project
- In your root file of your project type
fvm use <your version>
For example I use 2.0.5. just type
fvm use 2.0.5 to see if it is already used that version in your project. Execute this
fvm list command:
4. Set up to your IDE
Let configure your IDE. In my example, I will show you how to finish the setup process in VS code.
- After using the above commands to use your flutter SDK version. You will see
.fvmfolder in your root file.
cmd + ,then go to user setting.json and paste this:
- To get the above path simply execute
fvm listcommand. Then will show this:
// copy this path
Versions path: $YOUR_PATH/fvm/versions
- To use it please type
cmd + shift + pand type
change sdkand then you can choose your prefer version.
- In this example I choose Flutter SDK 2.0.5
5. How Run or Install library in your project
From now on, every commands want to use like
flutter run ,
flutter pub get , etc. You MUST prefix them by
// to run your project
fvm flutter run// to install libs
fvm flutter pub get
Flutter Version Management or (FVM) is simple cli to manage Flutter SDK versions.
FVM helps with the need for a consistent app builds by allowing to reference Flutter SDK version used on a per-project basis. It also allows you to have multiple Flutter versions installed to quickly validate and test upcoming Flutter releases with your apps, without waiting for Flutter installation every time.