Flutter version management in Visual Studio Code with FVM

What is FVM?#

Flutter Version Management (FVM) is a CLI utility that helps you work with multiple versions of the Flutter SDK.

If you are working on multiple Flutter projects, maybe some personal projects and some work projects, then FVM can save you time by seamlessly keeping each project pinned to a specific version of Flutter.

FVM can also help teams stay on the same Flutter version, preventing painful upgrade roll outs or dependency conflicts.

Use the steps below to install FVM and configure VS Code to work with it.

Install FVM#

In your terminal:

dart pub global activate fvm

Install a specific Flutter version#

In your terminal:

fvm install 2.2.1

Configure VS Code to use FVM#

In VS Code:

  1. CMD + SHIFT + P to open the Command Palette
  2. Select Preferences: Open Settings (JSON)

Add these options to your Settings JSON:

{
  "dart.flutterSdkPath": ".fvm/flutter_sdk",
  "dart.flutterSdkPaths": ["/Users/usr/fvm/versions"],
  // Remove .fvm files from search
  "search.exclude": {
    "**/.fvm": true
  },
  // Remove from file watching
  "files.watcherExclude": {
    "**/.fvm": true
  }
  // ... other settings
}

Configure your Flutter project to a specific version#

fvm use 2.2.1

In VS Code:

  1. CMD + SHIFT + P to open the Command Palette
  2. Select Developer: Reload Window

You can always see the current version used by VS Code in the bottom right of the VS Code window. If you followed the steps above, you should see:

Flutter: 2.2.1

That's it! If you have questions, find me on Twitter @seanconnollydev.

A newsletter for curious developers

Join me on the fantastic journey of software development. JavaScript, CSS, HTML, React, Next.js, Flutter, GraphQL, Fauna.