code-branchFVM

Fix Flutter version for your team with FVM

When we build Flutter projects in a team, using different Flutter versions can create hard bugs. So I use FVM (Flutter Version Managementarrow-up-right) to fix one Flutter version for the project.

My goals are simple:

  • New teammates can set up quickly.

  • The whole team uses the same Flutter version.

  • We can upgrade or downgrade version when needed.

Install FVM

Official doc: Installationarrow-up-right

Run:

dart pub global activate fvm

Check:

fvm --version

Fix Flutter version for the project

You can use one of these two ways.

Way 1: Use command

Official doc: Commands Referencearrow-up-right

Way 2: Set version in config file

Official doc: Configurationarrow-up-right

Create or update:

Content:

After this, the project will follow the exact version you set.

Add to .gitignore

Official doc: Configuration - Git Ignorearrow-up-right

To avoid committing cache files, add:

Use FVM in daily Flutter commands

Official doc: Running Flutterarrow-up-right

After setup, I always add fvm before Flutter commands:

This makes sure every command runs with the fixed Flutter version.

Setup flow for new teammates

When someone new joins the team, I share this short checklist:

  1. dart pub global activate fvm

  2. fvm use 3.27.4

  3. fvm flutter pub get

  4. fvm flutter run

With this flow, new teammates do not need to guess Flutter version.

Combine FVM with Make for shorter and safer commands

When the project grows, terminal commands become longer. So I combine FVM with Make to group many steps into one short command.

Step 1: Create a Makefile in project root

Example Makefile:

Step 2: Run one command

Without Make, most people need to type:

Result: from 3 lines to 1 line, easier to remember, easier to teach new teammates, and less chance to miss a step.

If you want full details about grouping commands with Make, check this article:

terminalMakechevron-right

Update + FVM - Version management

Official doc: Commands Referencearrow-up-right | Common Workflowsarrow-up-right | Release In Multiple Channelsarrow-up-right

When you need a new Flutter version, update with:

Or edit .fvm/fvm_config.json, then run again:

Buy Me a Coffeearrow-up-right | Support Me on Ko-fiarrow-up-right

Last updated