DEV Community

HAGTIC
HAGTIC

Posted on

How to install several Flutter SDK

To install multiple Flutter SDKs on your system, you can use Flutter version management tools. The most common tool for this purpose is flutter version.

Here are the steps to install multiple Flutter SDKs:

Install Flutter:
If you haven't installed Flutter yet, you can do so by following the official installation guide: Flutter - Get Started.

Install Dart SDK:
Flutter requires Dart, so make sure Dart SDK is installed. Flutter usually comes bundled with the Dart SDK.

Install Flutter Version Management Tool:
Use a version management tool like flutter version to easily switch between different Flutter versions.

flutter pub global activate fvm
Enter fullscreen mode Exit fullscreen mode

Make sure to add the Dart SDK binaries to your system's PATH. The command to add the binaries might look something like this:

export PATH="$PATH":"$HOME/.pub-cache/bin"
Enter fullscreen mode Exit fullscreen mode

Add the above line to your shell profile (e.g., .bashrc or .zshrc) so that it persists across sessions.

Initialize FVM:
Run the following command to initialize FVM:

fvm install [desired_flutter_version]
Enter fullscreen mode Exit fullscreen mode

Replace [desired_flutter_version] with the version of Flutter you want to install. For example:

fvm install 2.8.0
Enter fullscreen mode Exit fullscreen mode

Use Flutter Version:
Once installed, you can switch between Flutter versions using:

fvm use [desired_flutter_version]
Enter fullscreen mode Exit fullscreen mode

Verify Version:
Confirm that you are using the desired Flutter version by running:

flutter --version
Enter fullscreen mode Exit fullscreen mode

This should reflect the version you installed with fvm.

Repeat steps 4-6 for each Flutter version you want to install.

Remember that Flutter projects specify their Flutter SDK version in the pubspec.yaml file. When switching between projects, it's a good practice to run flutter pub get to ensure the correct dependencies are installed for the specified Flutter version.

This way, you can have multiple Flutter SDK versions installed on your machine and easily switch between them based on project requirements.

Top comments (0)