Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Development Environment  ›  Lesson

FVM — Pinning the Flutter Version

FVM 12 minFVM installs several Flutter SDK versions side by side and pins one per project, so everyone building the project uses the same version.

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 run
  • fvm use writes the chosen version into a small config file in the project (.fvmrc in current FVM). Commit that file so everyone reads the same pin.
  • FVM also makes a local .fvm folder 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. Plain flutter still 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.

Pinning Sprout's SDKStep 1 of 4
  1. Pin

    In the sprout folder, run fvm 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.

quick drill

What problem does FVM mainly solve?

quick drill

Which command pins Flutter 3.24.0 for the current project?

quick drill

After pinning, which command runs Sprout on the pinned SDK?

quick drill

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 flutter after pinning uses the global SDK.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainWhy pin a version?

A teammate clones Sprout, runs it, and gets errors you never see. You both have Flutter installed. Explain how different SDK versions could cause this, and describe how FVM would prevent it, including which commands and files are involved.