Managing multiple Flutter versions is a common need for developers working across different projects. FVM (Flutter Version Management) makes this easy and reliable.
This guide walks you through installing FVM, creating a new Flutter project, pinning a version, and upgrading global Flutter, all on Windows using Chocolatey.
Prerequisites
First, ensure you have Chocolatey installed.
- Install FVM with Chocolatey
Open PowerShell as Administrator and run:
choco install fvm
This installs FVM and adds it to your system PATH.
- Install Flutter 3.24.4 and Set it Globally
We’ll start by installing Flutter version 3.24.4
and setting it as the default for creating new projects.
fvm install 3.24.4
fvm global 3.24.4
You can verify the global Flutter version:
fvm flutter --version
Expected output:
Flutter 3.24.4
- Create a New Project and Pin the Version
Now create a Flutter app using the global version:
flutter create my_app
cd my_app
Then pin the project to Flutter 3.24.4
so it always uses that version:
fvm use 3.24.4
This creates a .fvmrc
file containing:
{
"flutter": "3.24.4"
}
This ensures that this project always uses Flutter 3.24.4, even if your global Flutter version changes later.
Use these commands to work within the project:
fvm flutter pub get
fvm flutter run
- Upgrade Global Flutter Version
Later, when a new Flutter version is released, upgrade your global version without affecting pinned projects:
fvm install stable
fvm global stable
This updates your system-wide Flutter, but existing projects still use the version specified in their .fvmrc
.
- Work with a Project from Someone Else
If you clone or receive a Flutter project that already has a .fvmrc
file:
cd some_project
fvm install
FVM will read .fvmrc
, install the required Flutter version, and set up everything.
Then run:
fvm flutter pub get
fvm flutter run