I want to install both flutter v1.22.6 and v2.0.5 on my mac.
currently I have v1.22.6 set up on my mac and have path for it set aswell.
I want a setup where if I enter the command flutter doctor that corresponds to v1.22.6 and when I enter the command flutter2 doctor that corresponds to v2.0.5

I am new to the terminal can someone please help? as of now flutter doctor corresponds to v1.22.6 only. I tried setting a path for flutter2 but that shows as no command found

Using the FVM (Flutter Version Management) would be an optimal solution.
Briefly, FVM is an open-source dependency management tool that helps with referencing a specific Flutter SDK version for a particular project, i.e. each project can use a different Flutter SDK version.
Run the following command:
dart pub global activate fvm
Or, using Homebrew:
brew tap leoafarias/fvm
brew install fvm
Finally, export the FLUTTER_ROOT path to be the FVM's default version, by adding the following in your .zshrc file (which can be found in your home directory):
export FLUTTER_ROOT=$HOME/fvm/default/bin
To confirm that FVM has been successfully installed, run fvm --version on the terminal to see version of the installed one.
Install the latest stable Flutter version by running the following command:
fvm install stable
Or, you could specify the version, as:
fvm install [version_number]
For instance, if you want the latest version in addition to 3.0.0, you should run the first and second commands (as fvm install 3.0.0).
In the terminal, change the directory to your project, and run the following command:
fvm use stable
stable could be replaced with a specified SDK version. At this point, each project will have its own Flutter SDK based on the fvm use version number.
However, you could also use the same version for all of your projects by running the following command:
fvm global stable
In the terminal, change the directory to your project, and run the following command:
fvm doctor
Or, since you can run the Flutter commands via the used FVM SDK, you could also run
fvm flutter --version
For more information about FVM, check the FVM documentaion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With