Sometimes we need to have multiple Flutter versions on the same machine for different projects. To do this, we should download multiple versions and add those paths to the bash_profile file and our IDE. I will use macOS and Visual Studio Code.
I assume that Flutter is already installed. So we should already have a Flutter SDK folder. Let's download a different version of Flutter and place it in the same folder as the current SDK folder.
In my case, as a default, I had an older version of Flutter. In addition to that, I downloaded the stable channel and renamed it
. Now I have two versions in two different paths:
Next, we duplicate the
file and rename it to
. Actually, we can give it any name. We will use this name instead of the
and add the path of the new version. In my case it looks like this (I added the second row):
Save, exit, and restart the terminal.
Verify if the path is correct with the command
. It must give something like this:
commands should give different versions.
Every project can use a specific version of Flutter. Open the settings of Visual Studio Code (
) and search 'flutter sdk paths'. Select the 'Dart & Flutter' in the left menu, click 'Add item', and add the paths. In my case the result looks like this:
Restart the Visual Studio Code. Now at the bottom right corner, we can select the flutter version:
As a result, we have two different versions of Flutter and we can use different versions for different projects.