agentleFS
jerelvelardejerelvelarde/chalk-skills/skills/flutter-version-management/SKILL.md

flutter-version-management

Skill8 starsChanged 9 months agoMITView on GitHub

Pins and manages per-project Flutter SDK versions with FVM (Flutter Version Management). Use when the project has or needs a .fvmrc or .fvm/ directory, when contributors need a reproducible Flutter SDK, when installing FVM, pinning or switching the Flutter version, wiring FVM into VS Code or Android Studio, configuring CI to honor .fvmrc, or troubleshooting "wrong Flutter version" symptoms.

  • Pipes a download into a shell
  • Installs packages

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the project has no pubspec.yaml, this is not a Flutter project — stop and ask the user before proceeding.

    line 15
  2. Distinctive:

    Run these in parallel and use the results to decide which steps below apply:

    line 21
  3. Very specific:

    After install, verify: fvm --version and fvm doctor.

    line 49
  4. Very specific:

    Run fvm use <version> from the project root.

    line 54
  5. Very specific:

    Add .fvm/ to .gitignore (keep .fvmrc tracked):

    line 59
  6. Very specific:

    Commit .fvmrc and the updated .gitignore.

    line 64
  7. Distinctive:

    After IDE setup, confirm Dart Analyzer picked up the change (Command Palette → *Dart: Restart Analysis Server*).

    line 94
  8. Very specific:

    Avoid installing FVM itself on CI runners — it adds startup time for no benefit.

    line 111

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flutter Version Management (FVM)

Overview

FVM pins a Flutter project to a specific SDK version so every contributor and CI runner builds against the same toolchain. This skill installs FVM, pins a project to a version, runs Flutter/Dart through FVM, configures IDEs, and wires up CI.

If the project has no pubspec.yaml, this is not a Flutter project — stop and ask the user before proceeding.

Workflow

1. Discover current state

Run these in parallel and use the results to decide which steps below apply:

fvm --version 2>/dev/null || echo "fvm-not-installed"
test -f .fvmrc && cat .fvmrc || echo "no-.fvmrc"
test -d .fvm && ls .fvm || echo "no-.fvm-dir"
test -f pubspec.yaml && grep -E "^\s*sdk:|^\s*flutter:" pubspec.yaml || echo "no-pubspec"
grep -E "(^|/)\.fvm(/|$)" .gitignore 2>/dev/null || echo ".fvm-not-in-gitignore"

Branch on results:

  • No FVM installed → Step 2 (Install FVM).
  • No .fvmrc → Step 3 (Pin a version).
  • .fvmrc exists but .fvm/flutter_sdk missing → run fvm install (Step 4).
  • All present, user wants to change version → Step 5 (Switch version).
  • CI / IDE setup requested → Steps 6 / 7.

2. Install FVM

Pick one method based on platform and existing tooling. Confirm with the user before installing.

PlatformRecommendedCommand
macOS (Homebrew user)brewbrew tap leoafarias/fvm && brew install fvm
Any Unixinstall scriptcurl -fsSL https://fvm.app/install.sh | bash
WindowsChocolateychoco install fvm
Has Dart alreadypubdart pub global activate fvm

After install, verify: fvm --version and fvm doctor.

3. Pin a version (new project or first-time pin)

  1. Decide which version. Default to the channel/version already in use; otherwise the latest stable. List options with fvm releases | tail -20 or use stable.
  2. Run fvm use <version> from the project root. This:
    • Downloads the SDK if missing (cached globally in ~/fvm/versions/).
    • Creates .fvmrc with {"flutter": "<version>"}.
    • Creates .fvm/flutter_sdk as a symlink to the cached SDK.
    • Runs flutter pub get (skip with --skip-pub-get for monorepos with custom bootstrap).
  3. Add .fvm/ to .gitignore (keep .fvmrc tracked):
    .fvm/
    !.fvmrc
  4. Commit .fvmrc and the updated .gitignore. Do not commit .fvm/flutter_sdk — it is a machine-local symlink to a cached SDK.

4. Install the version a project already pins

fvm install        # reads .fvmrc
fvm doctor         # confirms symlinks resolve and SDK is healthy
fvm flutter --version

5. Switch versions

  • Same project, new version: fvm use <version> (updates .fvmrc).
  • Force when contributing to a fork or a non-standard channel: fvm use <version> --force.
  • Pin to an exact release rather than the channel head: fvm use <version> --pin.
  • System-wide default for ad-hoc work outside any project: fvm global <version>. Then add the global symlink to PATH: export PATH="$HOME/fvm/default/bin:$PATH" (zsh/bash rc).

6. IDE setup

VS Code — write/merge .vscode/settings.json:

{
  "dart.flutterSdkPath": ".fvm/flutter_sdk",
  "search.exclude": { "**/.fvm": true },
  "files.watcherExclude": { "**/.fvm": true }
}

Android Studio / IntelliJ — point Flutter SDK path to <project>/.fvm/flutter_sdk in Preferences → Languages & Frameworks → Flutter. Restart the IDE after switching versions in .fvmrc.

After IDE setup, confirm Dart Analyzer picked up the change (Command Palette → Dart: Restart Analysis Server).

7. CI configuration

For GitHub Actions with subosito/flutter-action, read the version from .fvmrc so CI never drifts from local:

- name: Read Flutter version
  id: fvm
  run: echo "version=$(jq -r .flutter .fvmrc)" >> "$GITHUB_OUTPUT"

- uses: subosito/flutter-action@v2
  with:
    flutter-version: ${{ steps.fvm.outputs.version }}
    channel: stable

Avoid installing FVM itself on CI runners — it adds startup time for no benefit. The .fvmrc is the source of truth; the action consumes it directly.

8. Run Flutter / Dart through FVM

Once pinned, all Flutter and Dart commands must go through FVM in this project, otherwise contributors will silently use their global SDK:

fvm flutter pub get
fvm flutter run
fvm flutter test
fvm dart run build_runner build
fvm dart format .

Encourage a shell alias only at the user level (alias flu="fvm flutter"), never as a project-level script that masks the explicit fvm prefix.

9. Test against multiple versions

For library/package authors validating compatibility:

fvm spawn 3.19.0 test
fvm spawn 3.22.0 test
fvm spawn beta test

spawn runs the command against a specific version without changing the project's pinned version.

10. Maintenance

  • fvm list — show installed versions and which one each project uses.
  • fvm releases — list available Flutter releases.
  • fvm remove <version> — free disk space (each cached SDK is ~1–2 GB).
  • fvm doctor — diagnose broken symlinks, PATH, or cache corruption.
  • fvm destroy — nuclear option; removes the entire FVM cache. Confirm with the user before running — it deletes all cached SDKs across all projects.

Output

Report back to the user with:

  • Current Flutter version (from fvm flutter --version).
  • Files created or modified (.fvmrc, .gitignore, .vscode/settings.json, CI workflow).
  • Any commands the user must run themselves (e.g., shell PATH updates, IDE restart).
  • Verification commands they can run to confirm setup.

Anti-patterns

  • Mixing fvm flutter and bare flutter in the same project. The whole point of FVM is reproducibility; calling the global Flutter even once defeats it. Audit Makefile, package.json scripts, shell scripts, and CI for unprefixed flutter/dart calls.
  • Committing .fvm/flutter_sdk. It is a symlink to a machine-local cache — useless on another machine and bloats the repo if the symlink resolves on commit. Only .fvmrc belongs in version control.
  • Pinning to a channel name (stable, beta) on a serious project. Channels move. Two contributors running fvm install a week apart end up on different SDKs. Use a concrete version (3.22.0) for shipped projects; reserve channels for exploratory work.
  • Installing FVM on CI just to read .fvmrc. A one-line jq against .fvmrc plus subosito/flutter-action is faster and has fewer moving parts than installing FVM on every run.
  • Editing .fvm/flutter_sdk/ directly to patch an SDK bug. The symlink target is shared across projects; edits leak everywhere and disappear on fvm install. Use fvm use <fork>/<branch> to point at a fork instead.
  • Running fvm destroy to "clean up". It wipes every cached SDK on the machine, forcing every project to re-download gigabytes. Use fvm remove <version> for targeted cleanup.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.