A Step-by-Step Guide to Flutter Version Management

Back to Blogs

Introduction

Have you ever found yourself working on several projects concurrently, each using a different version of Flutter? Additionally, you must continually switch between them, which can take a lot of time and energy.

This is where FVM's reference to the Flutter SDK version used for each project comes in handy for the requirement for consistent app builds. Additionally, it enables you to install various versions of Flutter so that you can test and validate new releases of the framework with your apps without having to wait for Flutter to install each time.

How to use FVM

Before installing fvm make sure that dart is installed.

To Install FVM

Open the terminal and run the command to install FVM.

$ dart pub global activate fvm

USE

To install Futter SDK version for project. It will prompt you to install the version if one doesn't already exist.

$ fvm use {version}

To Install Flutter SDK

Installs Flutter SDK Version. It enables you to set up channels or releases for Flutter.

$ fvm install {version}

List

List of installed Flutter SDK versions on you system.

$ fvm list

Releases

To view all Flutter SDK releases available for install.

$ fvm releases

Remove

This command will remove the installed Flutter SDK version.

$ fvm remove {version}

 

Configuration

To Configure FVM and IDEs.

Project

In your project, FVM will establish a relative symlink from.fvm/flutter_sdk to the chosen version's cache.

To ignore add it to your. gitignore

.fvm/flutter_sdk

 

IDEs

Configuration from VS code IDE

For a dynamic switch, the version symlink can be added. For all IDE tooling, Visual Studio Code will always use the version that is chosen within the project.

Steps

  1. Search user setting using Ctrl+ shift+P
  2. Add the following the json

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

 

Configuration from Android studio

Steps

  1. Go to Languages & Frameworks > Flutter or search for Flutter and change Flutter SDK path.
  2. Copy the absolute path of fvm symbolic link in your root project directory. Example: /absolute-project-path/.fvm/flutter_sdk
  3. Apply the changes.
  4. Restart Android Studio to see the new settings applied.

Other Articles