Flutter Version Management
In my recent demo at #FlutterCon Kenya on WebAssembly in Flutter web apps (article coming soon), I needed to have simultaneous use of multiple Flutter SDKs. Until this point, I actually didn’t have such a use case. And this led me to FVM — Flutter Version Management.
So, what is FVM?
FVM (Flutter Version Manager) is a tool that allows you to manage multiple Flutter versions on your machine. With the frequent Flutter updates, it becomes important to know how to manage these different versions as needed by your project.
Why use FVM?
- Versions for a specific project. As mentioned above, there might come a time where different projects require different Flutter versions simultaneously. With FVM you can have different Flutter versions assigned to different projects as needed without causing any overlaps or mismatches.
- Version management. Instead of having to consistently install, uninstall, upgrade and downgrade different versions of Flutter manually, FVM easily manages everything through simple commands.
- Easy rollbacks. Because it is so easy to switches between versions, FVM makes it easy to revert to a previous Flutter version. This is especially useful if working with another version leads to unexpected errors and/or incompatibilities.
- Conciseness in development teams. A lot of inconsistencies occur in development environments within teams. With FVM, you can ensure everyone on the team is developing on the same Flutter version.
- SDK testing. For developers who are interested in testing the Flutter SDK, this process requires constant channel switching. It is easier to manage these switches with FVM.
Getting started with FVM
It is quite simple to get up and running with FVM.
FVM can be installed via the pub
command as follows: dart pub global activate fvm
Once installed, endure that FVM will be accessible by adding it to your environment variables / paths.
With that you are ready to install specific Flutter versions. This can be done by simply running the command fvm install <version>
where you replace <version> with the actual version needed. E.g., fvm install 3.24.0
You can find the archive of all Flutter versions here.
FVM can also supports version aliases such as stable
, beta
, and master
E.g., fvm install stable
To see all the versions you have installed, use the command fvm list
To set a particular version as the default for a specific project, run fvm use <version>
E.g., fvm use 3.16.0
This will create a .fvm file at the root of the project.
And to remove a specific version just simply fvm remove <version>
Just with these few steps, I was able to easily switch between the two versions from the screenshot above. So, I hope this also helps you out!
Do you use FVM? I’d like to know if you do and how your experience has been so far. Also, do let me know if I have left something out.
“I am in the process of becoming the best version of myself.”
— Nissi
Thank you so much for reading ❤