Articles/Flutter/Flutter Version Management

Flutter Version Management

Managing multiple Flutter versions does not need not be a headache. Let's jump into FVM and see how it can simplify your Flutter journey.

October 7, 2023·2 min read

As you dive deep into Flutter you'll probably start to wonder how you can juggle multiple versions of Flutter per project. This is where FVM (Flutter Version Management) helps. Its purpose is managing different Flutter versions, allowing you to set specific versions for each of your projects.

Setting Up FVM on macOS

Installation

On macOS, we'll start by getting Dart. If you don't have it yet, install it through Homebrew:

BASH
brew tap dart-lang/dart
brew install dart

Now let's install FVM. You can do so in a couple of different ways.

Option 1: Using Dart

BASH
dart pub global activate fvm

Option 2: Directly via Homebrew

BASH
brew install fvm

Exploring Available Versions

You can check the available Flutter versions with the following command:

BASH
fvm releases

Installing a Specific Version

You can install specific versions of Flutter using the following command:

BASH
fvm install <version>

Switching Between Versions

Swapping between Flutter versions is as easy as follows:

BASH
fvm use <version>

When you run the fvm use <version> command within your project directory, here's what happens:

  • FVM creates a symbolic link in your project directory to the specified Flutter version you want to use. This symbolic link is directed to the .fvm/flutter_sdk directory.
  • The fvm use command adjusts the Flutter SDK path for your project to point to the selected version.
  • With the selected Flutter version now active, any version-specific dependencies in your project will now align with your set version of Flutter, ensuring compatibility as you develop.

Setting a Global Default Version

You can set a global default version of Flutter on your system with the following command:

BASH
fvm global <version>

And that's it. This will allow you to now switch between versions easily as you work on projects.