FVM — Pinning the Flutter Version
Flutter ships new stable versions several times a year. Sprout builds fine on your laptop; a friend clones it and gets a wall of errors because their Flutter is a few releases older. Nothing is wrong with the code. The two of you are simply compiling it with different SDKs.
The rule
One project, one pinned Flutter version, written down in the repo.
FVM (Flutter Version Management) is a command-line tool that keeps several Flutter SDKs on one machine and lets each project choose its own.
fvm install 3.24.0 # download that SDK into FVM's cache
fvm use 3.24.0 # pin it for the project in this folder
fvm flutter --version # run flutter through the pinned SDK
fvm flutter runfvm usewrites the chosen version into a small config file in the project (.fvmrcin current FVM). Commit that file so everyone reads the same pin.- FVM also makes a local
.fvmfolder that links to the SDK on your machine. That folder is machine-specific, so it stays out of Git. fvm flutter ...is the everyday form: it forwards any command to the pinned SDK. Plainflutterstill uses your global install.- Editors can be pointed at the pinned SDK too, so the analyzer and the terminal agree.
The shortcut
Treat the Flutter version like any other dependency: pin it, commit it, run through it.
Pin
In the
sproutfolder, runfvm use 3.24.0. The pin is recorded in the project.
The trap is pinning and then typing plain flutter run out of habit. That uses the global SDK, and the version mismatch returns quietly.
Drills
Answer fast — trust the rule.
What problem does FVM mainly solve?
Which command pins Flutter 3.24.0 for the current project?
After pinning, which command runs Sprout on the pinned SDK?
What should be committed to Git?
Remember
- One project, one pinned Flutter version, written down in the repo.
- Pin it (
fvm use), commit the config, run through it (fvm flutter). - Trap: typing plain
flutterafter pinning uses the global SDK.
