How to Setup Multiple Flutter Versions on Mac?
If you are a flutter developer, working on projects with different flutter versions and using Macbook. You have definitely faced this problem that how to run projects with different flutter versions at the same time. If you will use FVM (Flutter version management) You can get rid of this problem. FVM is just a simple CLI that is used to manage different flutter versions with different projects. There are a few steps you have to follow to install and set up FVM on your pc.
Step by Step Implementation
Step 1. Install Brew
If you already have brew installed then you can skip this step. Run this command in your terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2. Check whether brew is installed or not
Check whether the brew is installed or not. By typing brew –version in your terminal. If it was installed you will get different commands available in the brew.
Step 3. Install FVM
brew install fvm
Step 4. Check whether FVM is installed or not
After installing check whether FVM is installed or not by typing fvm –version if it will show the version number
Step 5. You are ready to use FVM for your flutter projects
Go to the project folder and write this in your project folder terminal. So that your project starts getting access to all flutter command
fvm use {version}
Note: Whenever you install a new flutter version it will take some time as well as your internet .as it will download those particular flutter SDKs in your device.
Step 6. Now your project uses FVM
Run any command with FVM as prefix like
- fvm flutter run
- fvm flutter build apk
Bonus Point
If you want to create a project in flutter then if you use the command
fvm use {version}
It will give you this error
For creating a flutter project using FVM you can use this command first after that command for creating a flutter project with fvm as prefix
fvm use {version} --force
Now you are good to go!!