How to install FVM(Flutter Version management) on your system.

How to install FVM(Flutter Version management) on your system.

For every Flutter developer, one thing we are all scared of is upgrading our Flutter version for we are not emotionally and mentally ready for what comes after need I say more?

FVM(Flutter Version management) provides a way for Flutter developers to have multiple versions of Flutter on their system, so when the next Flutter update pops up rest assured you will be emotionally ready for it.

What is FVM?

Flutter Version Manager (FVM) is the easiest way to manage Flutter SDK versions on your machine. FVM helps with the need for 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. in short no more emotional damage.

How to install FVM

The installation of FVM is a very easy process but before we continue we have to make sure we have chocolatey installed on your machine to check if you have it installed you can run the command "choco" in your terminal if you don't get any errors you are good to go if you do you might need to install it, head over to chocolatey follow the installation process then install for your machine.

For Windows you are to use Chocolatey for Linux or Mac, you are to make use of Brew so make sure you have it installed before you continue

To continue with the installation of FVM head over to fvm to install FVM for your machine by copying the installation commands to your terminal.

If you run into errors while installing this may be because you did not open your terminal as an administrator.

You are back I know it took a while to install, but to check if it was successfully installed run the command "fvm" on your terminal if you don't run into any errors then you have successfully installed it.

How to setup FVM

Now that you have installed fvm let's set it up so we can use it in our projects. Let's start by running the command "fvm releases" You should see a whole lot of Flutter versions available for you to install so you can choose to install any of your choice, so now you can install the updated Flutter version as well as the current flutter version you are currently using.

To install a flutter version all you have to do is run the command "fvm install 'flutter version' "e.g. "fvm install 3.0.0" This will take a while to install but it will be all worth it in the end.

How to configure FVM

After the installation of the different versions of Flutter SDK, you might have your system it's time to configure it, you have to pick which one you want as the global version(The main version ) run the command "fvm list" This should display the list of flutter versions you have installed your machine. To make one global all you have to do is run the command "fvm global 'the version number' ". now if you run "fvm list" once more you should see the global version.

How to use FVM

Now that we have configured our fvm let's check out how to use it in our flutter projects.

  • To create a new FVM project you have to run the command "fvm flutter create 'project name' ".

  • Let's say you have a project already created and you want to change the flutter version of the project all you have to do is run the command "fvm use 'flutter version' " in the terminal of your project(project root directory).

You should see a fvm folder in your project directory.

You can also change the Flutter version at any time in your project all you have to do is run the command "fvm use 'flutter version' " .

When using fvm your normal flutter commands like "flutter run" ,"flutter pub get" would no longer work all you have to do is to add fvm before the command to make it functional like "fvm flutter run" ,"fvm flutter pub get".