Related
I'm getting this warning after using "Flutter Doctor" command after the installation of Dart using brew tap dart-lang/dart on MacOS Big Sur
Flutter (Channel stable, 3.7.0, on macOS 11.7.2 20G1020 darwin-x64,
locale
en-GB)
! Warning: dart on your path resolves to
/usr/local/Cellar/dart/2.19.1/libexec/bin/dart, which is not inside your
current Flutter SDK checkout at /Users/puneet/development/flutter.
Consider adding /Users/puneet/development/flutter/bin to the front of your
path.
Can you anyone tell me how can i resolve this issue?
I'm trying avoid this warning and run a code on android studio developed on flutter framework.
I resolve this warning by just uninstalling the dart sdk using this command -
brew uninstall dart
Since dart sdk already comes with flutter installation, you need not to install it seperately.
Here is how I solve this problem
My dart path on environmental variable was look like (Both user and system variable)
C:\src\dart-sdk\bin
Now I change it to
C:\src\dart-sdk\bin\dart.exe
and the problem resolved.
The Flutter framework also contains Dart. So, if you already installed Dart separately on your OS, remove Dart and its Path from your system. You should have only one Path that is: /Users/puneet/development/flutter/bin
SOLVED
when you update your flutter to the latest version this warning comes in your flutter doctor output:-
for solving this just go and open .zshrc and after that check your flutter bin path is like this:-
change your path into this:-
and then run flutter doctor again... PROBLEM SOLVED ☺️
I can build flutter project .
but I did catch warning by flutter doctor
I want fix .
warning code
[!] Flutter (Channel stable, 3.7.0, on macOS 13.0.1 22A400 darwin-arm64, locale ja-JP)
! Warning: `dart` on your path resolves to
/opt/homebrew/Cellar/dart/2.14.4/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/t/Developer/flutter.
Consider adding
/Users/t/Developer/flutter/bin to the front of your path.
tried
set -x PATH ~/development/flutter/bin $PATH
fltter clean
Just remove old dart from homebrew
brew remove dart
Important note from flutter documentation:
The Flutter SDK contains the dart command alongside the flutter command so that you can more easily run Dart command-line programs. Downloading the Flutter SDK also downloads the compatible version of Dart, but if you’ve downloaded the Dart SDK separately, make sure that the Flutter version of dart is first in your path, as the two versions might not be compatible.
The previous text means that flutter SDK has Dart SDK inside it, So you don't need to download dart separately.
To solve this proplem :
Delete the dart SDK that you download separately.
Go to the environment variables then select the Path from the user variables.
Change C:\src\dart-sdk\bin to C:\src\flutter\bin\dart
I solved it by adding the dart/ directory inside flutter/bin directory.
Hope this might help! :D
I fixed it by deleting the separate "dart-sdk" folder that I downloaded, and keeping the downloads from the flutter which has everything in it already.
Mine was in C \ tools \ dart-sdk
You may also have to change\delete the env path that had dart-sdk separate, and only keep the flutter\bin path. I have both flutter\bin & flutter\bin\dart. Not sure if both are needed but mine worked.
I was facing the same issue after upgraded to 3.7.x. In my case, I didn't set anything about Flutter in my .zshrc, I just created a symbolic link instead like this:
sudo ln -sfn /Users/lin/flutter/bin/flutter /usr/local/bin/flutter
So, when I am facing this issue, I think it would probably be working for Dart as well. Here is how I fixed it:
(1) Verify Dart:
which dart
It prompted dart not found
(2) Create a symbolic link for Dart:
sudo ln -sfn /Users/lin/flutter/bin/dart /usr/local/bin/dart
(3) Verify Dart again:
which dart
It prompts: /usr/local/bin/dart
dart --version
It prompts Dart SDK version: 2.19.2 (stable) (Tue Feb 7 18:37:17 2023 +0000) on "macos_x64"
(4) At this point, it will be working if you type:
flutter doctor -v
I upgraded my Flutter SDK and now my project is broken. I need to basically revert back to a Flutter SDK which uses Dart 1.x.
I tried the following in the pubspec.yaml,
environment:
sdk: ">=1.19.0 <2.0.0"
flutter: "^0.1.2"
dependencies:
flutter:
sdk: flutter
but now the project just simply doesn't build.
Running "flutter packages get" in binformed...
Package binformed requires Flutter SDK version ^0.1.2 but the current SDK is 0.2.5-pre.38.
pub get failed (1)
Do i need to uninstall the SDK and reinstall it?
Flutter is versioned using git. Changing the Flutter version is as simple as changing git branch.
There are 2 different ways:
flutter channel <branch> (example: flutter channel stable)
This command is used to change between branches – usually stable/dev/beta/master.
We can also put a specific commit id from git.
flutter downgrade <version> (example: flutter downgrade v1.2.1)
This command will use a specific version number.
You can have the list of the available version numbers using flutter downgrade or here
After this, run any Flutter command (such as flutter doctor), and Flutter will take care of downloading/compiling everything required to run this version.
Run the following command to see a list of available versions.
flutter version
Then choose a version you want to switch to by running
flutter version v1.2.1
To undo and revert back to stable
flutter channel stable
flutter upgrade
In the Flutter install directory execute
git checkout v0.1.9
then run
flutter doctor
You can check which versions are available in the Flutter GitHub repository https://github.com/flutter/flutter
There is an open feature request to make this easier https://github.com/flutter/flutter/issues/14230
Don't use flutter version vX.X.X, use flutter downgrade instead.
Warning: "flutter version" will leave the SDK in a detached HEAD state. If you are using the command to return to a previously installed SDK version consider using the "flutter downgrade" command instead.
So, you should use
flutter downgrade
Edit:
If there had been no previous versions installed, the above command would fail. So, if you have a specific version of Flutter that you’d like to switch to, you can use the flutter version command:
flutter downgrade v1.17.0
You can find list of versions here
To downgrade there are many deprecated commands.
The two that actually work, and I've tested them, are:
flutter downgrade v[flutter build version]
For instance:
flutter downgrade v1.22.6
And the other one: go to your flutter sdk folder, that is your folder named "flutter" and inside it open a new terminal. Then type:
git checkout [flutter build version]
For instance:
git checkout 1.22.3
Then do flutter doctor and you'll confirm you switched correctly.
You can check the versions on: https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
And for details at: https://flutter.dev/docs/release/breaking-changes
If you happen to want to switch channel, just do:
flutter channel [channel]
For instance (choose one of master, stable, dev, beta):
flutter channel stable
And if you want to upgrade again:
flutter upgrade
Inorder for a proper downgrade to any version.
Change to Dev mode
flutter channel dev
flutter downgrade v(type your version number) eg below.
flutter downgrade v2.0.6
This worked for me !
Go to the terminal and type the specific version number, for eg -
flutter downgrade v1.22.3
Then just press enter.
After fetching the files from the internet, it will ask,
Downgrade flutter to version 1.22.5
? [y|n]:
Type y and it will downgrade to the specific version.
Restart the IDE for the settings to take place.
To solve these errors:
$ flutter version
Could not find a command named "version".
$ flutter downgrade v1.22.6
There is no previously recorded version for channel "stable".
Delete old flutter folder
Download the archive and unzip instead of deleted flutter folder
OR
cd "$(dirname $(which flutter))" then
git checkout . (optional)
git pull origin (optional)
git checkout v1.22.6
flutter doctor
p.s.
Don't forget to restart your android studio
At the moment, the easiest way to manage flutter versions is through fvm.
Install fvm
brew tap leoafarias/fvm
brew install fvm
Install your version
fvm install x.x.x
Install your version globally (if desired)
fvm global x.x.x
Here's a link to the app guide
https://fvm.app/docs/getting_started/installation
Just use flutter downgrade v2.8.0
then flutter ask for confirmation
Downgrade flutter to version 1.22.5
? [y|n]:
Type y for Yes to confirm changes
Download Flutter SDK release: flutter_windows_1.17.0-stable: https://flutter.dev/docs/development/tools/sdk/releases
Replace the existing Flutter folder to this version
Make sure that environment variables and Flutter + Dart Settings on your IDE
are still tied to this folder/path
Just flutter downgrade is enough, it will downgrade to previous stable version.
I find it a little tough to switch (upgrade/downgrade) to a specific Flutter version from the command line. Some of the answers here are outdated.
I prefer to download the SDKs for different versions from here manually.
Let's say I download 2.0.1, 2.0.5 and 2.0.6.
2.0.1 is the current Flutter SDK version for me.
To switch to 2.0.5, delete the current Flutter SDK (the one with the blue icon) and unzip flutter_macos_2.0.5-stable.zip. Then run flutter clean followed by flutter doctor to confirm that everything worked correctly.
This has the benefit of not having to change any paths or having to re-download the entire SDK every time you want to switch.
On macOS, if you get system warnings for not being able to run dart or gentool, then press Allow anyway under System Preferences > Security & Privacy
The simplest way to change your flutter version is to:
Navigate to this link and download the flutter version you want.
Extract the files and replace your older flutter directory with them.
If you were using flutter already then no need to redefine the PATH, else, make sure that environment variables are still tied to this folder/path.
Run flutter --version or flutter doctor to check that everything went ok.
I found 2-steps easy solution to migrate to any specific version of Flutter.
Navigate to Flutter repo path (Yes, the one we download from official website and unzipped it) in a terminal
Run the following command : git checkout 2.10.5 && flutter precache
Note: Verify & change the Flutter version from here
Open Terminal and Navigate to Flutter folder
Run the following command with the Flutter version you want to switch to:
git checkout 2.10.5 && flutter precache
Reference: https://github.com/flutter/flutter/issues/64238#issuecomment-678605514
All the answers are outdated and not working after the release of flutter 3.0.
My solution is somewhat complicated but will still work in May 2022 and after.
I will show you how to downgrade from flutter 3 to Flutter 1.22.6.
the first step is to locate where you have to install flutter files when you have installed them for the 1st time. Like mine is located in c:\src\flutter.
Cut the flutter folder and paste it somewhere. (note:- you have shutdown your android studio/vs code if running)
go to Flutter SDK releases and download the desired flutter version you want. I choose flutter 1.22.6 for windows.
now extract the downloaded flutter zip and paste in c:\src\flutter (or wherever your flutter was installed previously). (don't worry if you're thinking that your Environment Variables path will change, so that is not true, it will still work. you don't have to change anything in Environment variables)
After pasting the flutter extracted folder open android studio and go to File/Setting/language and framework/flutter and correct the Flutter SDK path to C:\src\flutter.(as shown in the image).
6. Now press apply and run flutter --version
if you are using brew (macos)
you can create rb file and use brew to install or downgrade flutter
create file with name flutter.rb
cask "flutter" do
version "2.2.0"
url "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_#{version}-st$
verified: "storage.googleapis.com/flutter_infra_release/"
name "Flutter SDK"
desc "UI toolkit for building applications for mobile, web and desktop"
homepage "https://flutter.dev/"
livecheck do
url "https://storage.googleapis.com/flutter_infra_release/releases/releases_macos.json"
regex(%r{/flutter[._-]macos[._-]v?(\d+(?:\.\d+)+)[._-]stable\.zip}i)
end
auto_updates true
binary "flutter/bin/dart"
binary "flutter/bin/flutter"
end
then use brew install ./flutter.rb to install flutter or downgrade flutter version
This solutions works in 2021
Go to your flutter SDK folder, which is your folder named "flutter" and inside it open a new terminal. Then type:
git checkout (your flutter version)
then,
run flutter doctor
After this check your version.
To downgrade your flutter version:
Run flutter downgrade v2.5.3 or whatever flutter version you want from here.
If it resulted in any error like
There is no previously recorded version for channel "stable".
or that there is no previous version,
then, make sure to switch to the correct branch {stable, master, dev, beta} using the following command:
flutter channel master
Finally, Run flutter doctor to check that everthing went well.
These are the flowing step to downgrade any flutter version:
Step 1:
cd [your flutter sdk path]
Step 2:
git checkout [ enter your version ref ]
To get ref goto the url and copy your desired version ref.
https://docs.flutter.dev/development/tools/sdk/releases
Suppose I downgrade version 3.3.2
Step 3:
flutter doctor or flutter --version
Downgrade to a specific version on stable channel
Locate flutter path:
whereis flutter
On flutter folder execute
# clean the repo
git clean -fdx
git reset --hard
git fetch --all --prune
# list available tags starting with 2.10
git tag | grep 2.10
# checkout to stable on tag
git checkout stable
git reset --hard 2.10.5
Finally download the flutter tools
flutter doctor
The easiest way is to go to your flutter sdk, if you're on Linux open terminal and run flutter sdk-path then cd to the sdk path.
run git checkout <ref_of_sdk_you_want>. access the sdk versions here. after the switch, run flutter doctor and restart your IDE, that's it.
You can switch between versions using this way.
Steps to change the Flutter version is as simple as changing the git branch.
flutter channel <branch> (example: flutter channel stable)
This command is used to change between branches – usually stable/dev/beta/master. We can also put a specific commit id from git.
flutter downgrade <version> (example: flutter downgrade v1.2.1)
This command will use a specific version number. You can have the list of the available version numbers using flutter downgrade
After this, run any Flutter command (such as flutter doctor), and Flutter will take care of downloading/compiling everything required to run this version.
I'm extremely frustrated right now after I updated Android Studio to have the latest Flutter and Dart Plugins. Now it tells me "No FLutter SDK configured" and when I give it the SKD path it just says, "Flutter SDK Is Not Found In The Specified Location." The Dart plugin works fine.
I have looked for an answer for hours and nothing works. I've downloaded the NDK, flutter doctor works perfectly, and I've tried set the SDK path to pretty much every file inside my flutter folder (inside /Documents).
Any tips?
Go to - Configure -> Tools > SDK Manager > Android SDK > SDK Tools, and search for flutter. You will get flutter SDK for Android.
If you are using Visual studio, also install plugins for flutter in Visual Studio.
» Steps:
Download Flutter SDK: Here
Extract Flutter:
tar xf ~/Downloads/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
Path export for particular terminal:
export PATH="$PATH:`pwd`/flutter/bin"
Permanent Path export:
Open bashrc file: Go to home directory terminal -> nano ~/.bashrc
Write at end of file:
export PATH=" [PATH_Where_Flutter SDK Extracted] /flutter/bin:$PATH"
example: export PATH="/home/sid/0_aaa_iauro/Flutter/s/flutter/bin:$PATH"
Run the following command to see if there are any dependencies you need to
install to complete setup:
flutter doctor -v
Add Flutter extension to vs-code.
Locate Flutter SDK.
Make New project in flutter:
flutter create Project_name
» Important Links:
Linux Install
Getting Started with Flutter on Linux for Android [Beginner Tutorial]
How To Install And Setup Flutter On Ubuntu 18.04.1 LTS (Bionic Beaver)
Part 2-A: Install Flutter in Windows – Step by Step Guide
Check for path variable (bashrc file):
Flutter – Step by Step Installation on Linux – Ubuntu
If you are using a fresh new Android Studio install as me, try installing missing packages for SDK support in Android Studio as described here: https://ladwhocodes.blogspot.com/2019/02/fix-flutter-sdk-not-found-in-specified-location.html
Go to Menu > Tools > SDK Manager > Android SDK (left side of the dialog) > SDK Tools (tab).
Select 'Support Repository' and 'NDK' checkboxes.
Click OK.
It will prompt you to install some dependencies. Install them.
What happen to me was because there is a space in my android sdk path (which is my username). I copy to C:\android\sdk and problem gone. Probably the space cause issue to NDK thus affect to Flutter sdk.
in my case, it was caused by local changes to the flutter git repo. On command line, everything worked, but in Android Studio it failed to detected the flutter sdk which caused all flutter commands to fail (even though flutter bin dir is in my path). The local changes were probably caused by trying out the beta version of flutter and returning to stable afterwards.
solution: delete flutter dir and redownload (I actually reverted all changes using the git clean command)
I upgraded my Flutter SDK and now my project is broken. I need to basically revert back to a Flutter SDK which uses Dart 1.x.
I tried the following in the pubspec.yaml,
environment:
sdk: ">=1.19.0 <2.0.0"
flutter: "^0.1.2"
dependencies:
flutter:
sdk: flutter
but now the project just simply doesn't build.
Running "flutter packages get" in binformed...
Package binformed requires Flutter SDK version ^0.1.2 but the current SDK is 0.2.5-pre.38.
pub get failed (1)
Do i need to uninstall the SDK and reinstall it?
Flutter is versioned using git. Changing the Flutter version is as simple as changing git branch.
There are 2 different ways:
flutter channel <branch> (example: flutter channel stable)
This command is used to change between branches – usually stable/dev/beta/master.
We can also put a specific commit id from git.
flutter downgrade <version> (example: flutter downgrade v1.2.1)
This command will use a specific version number.
You can have the list of the available version numbers using flutter downgrade or here
After this, run any Flutter command (such as flutter doctor), and Flutter will take care of downloading/compiling everything required to run this version.
Run the following command to see a list of available versions.
flutter version
Then choose a version you want to switch to by running
flutter version v1.2.1
To undo and revert back to stable
flutter channel stable
flutter upgrade
In the Flutter install directory execute
git checkout v0.1.9
then run
flutter doctor
You can check which versions are available in the Flutter GitHub repository https://github.com/flutter/flutter
There is an open feature request to make this easier https://github.com/flutter/flutter/issues/14230
Don't use flutter version vX.X.X, use flutter downgrade instead.
Warning: "flutter version" will leave the SDK in a detached HEAD state. If you are using the command to return to a previously installed SDK version consider using the "flutter downgrade" command instead.
So, you should use
flutter downgrade
Edit:
If there had been no previous versions installed, the above command would fail. So, if you have a specific version of Flutter that you’d like to switch to, you can use the flutter version command:
flutter downgrade v1.17.0
You can find list of versions here
To downgrade there are many deprecated commands.
The two that actually work, and I've tested them, are:
flutter downgrade v[flutter build version]
For instance:
flutter downgrade v1.22.6
And the other one: go to your flutter sdk folder, that is your folder named "flutter" and inside it open a new terminal. Then type:
git checkout [flutter build version]
For instance:
git checkout 1.22.3
Then do flutter doctor and you'll confirm you switched correctly.
You can check the versions on: https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
And for details at: https://flutter.dev/docs/release/breaking-changes
If you happen to want to switch channel, just do:
flutter channel [channel]
For instance (choose one of master, stable, dev, beta):
flutter channel stable
And if you want to upgrade again:
flutter upgrade
Inorder for a proper downgrade to any version.
Change to Dev mode
flutter channel dev
flutter downgrade v(type your version number) eg below.
flutter downgrade v2.0.6
This worked for me !
Go to the terminal and type the specific version number, for eg -
flutter downgrade v1.22.3
Then just press enter.
After fetching the files from the internet, it will ask,
Downgrade flutter to version 1.22.5
? [y|n]:
Type y and it will downgrade to the specific version.
Restart the IDE for the settings to take place.
To solve these errors:
$ flutter version
Could not find a command named "version".
$ flutter downgrade v1.22.6
There is no previously recorded version for channel "stable".
Delete old flutter folder
Download the archive and unzip instead of deleted flutter folder
OR
cd "$(dirname $(which flutter))" then
git checkout . (optional)
git pull origin (optional)
git checkout v1.22.6
flutter doctor
p.s.
Don't forget to restart your android studio
At the moment, the easiest way to manage flutter versions is through fvm.
Install fvm
brew tap leoafarias/fvm
brew install fvm
Install your version
fvm install x.x.x
Install your version globally (if desired)
fvm global x.x.x
Here's a link to the app guide
https://fvm.app/docs/getting_started/installation
Just use flutter downgrade v2.8.0
then flutter ask for confirmation
Downgrade flutter to version 1.22.5
? [y|n]:
Type y for Yes to confirm changes
Download Flutter SDK release: flutter_windows_1.17.0-stable: https://flutter.dev/docs/development/tools/sdk/releases
Replace the existing Flutter folder to this version
Make sure that environment variables and Flutter + Dart Settings on your IDE
are still tied to this folder/path
Just flutter downgrade is enough, it will downgrade to previous stable version.
I find it a little tough to switch (upgrade/downgrade) to a specific Flutter version from the command line. Some of the answers here are outdated.
I prefer to download the SDKs for different versions from here manually.
Let's say I download 2.0.1, 2.0.5 and 2.0.6.
2.0.1 is the current Flutter SDK version for me.
To switch to 2.0.5, delete the current Flutter SDK (the one with the blue icon) and unzip flutter_macos_2.0.5-stable.zip. Then run flutter clean followed by flutter doctor to confirm that everything worked correctly.
This has the benefit of not having to change any paths or having to re-download the entire SDK every time you want to switch.
On macOS, if you get system warnings for not being able to run dart or gentool, then press Allow anyway under System Preferences > Security & Privacy
The simplest way to change your flutter version is to:
Navigate to this link and download the flutter version you want.
Extract the files and replace your older flutter directory with them.
If you were using flutter already then no need to redefine the PATH, else, make sure that environment variables are still tied to this folder/path.
Run flutter --version or flutter doctor to check that everything went ok.
I found 2-steps easy solution to migrate to any specific version of Flutter.
Navigate to Flutter repo path (Yes, the one we download from official website and unzipped it) in a terminal
Run the following command : git checkout 2.10.5 && flutter precache
Note: Verify & change the Flutter version from here
Open Terminal and Navigate to Flutter folder
Run the following command with the Flutter version you want to switch to:
git checkout 2.10.5 && flutter precache
Reference: https://github.com/flutter/flutter/issues/64238#issuecomment-678605514
All the answers are outdated and not working after the release of flutter 3.0.
My solution is somewhat complicated but will still work in May 2022 and after.
I will show you how to downgrade from flutter 3 to Flutter 1.22.6.
the first step is to locate where you have to install flutter files when you have installed them for the 1st time. Like mine is located in c:\src\flutter.
Cut the flutter folder and paste it somewhere. (note:- you have shutdown your android studio/vs code if running)
go to Flutter SDK releases and download the desired flutter version you want. I choose flutter 1.22.6 for windows.
now extract the downloaded flutter zip and paste in c:\src\flutter (or wherever your flutter was installed previously). (don't worry if you're thinking that your Environment Variables path will change, so that is not true, it will still work. you don't have to change anything in Environment variables)
After pasting the flutter extracted folder open android studio and go to File/Setting/language and framework/flutter and correct the Flutter SDK path to C:\src\flutter.(as shown in the image).
6. Now press apply and run flutter --version
if you are using brew (macos)
you can create rb file and use brew to install or downgrade flutter
create file with name flutter.rb
cask "flutter" do
version "2.2.0"
url "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_#{version}-st$
verified: "storage.googleapis.com/flutter_infra_release/"
name "Flutter SDK"
desc "UI toolkit for building applications for mobile, web and desktop"
homepage "https://flutter.dev/"
livecheck do
url "https://storage.googleapis.com/flutter_infra_release/releases/releases_macos.json"
regex(%r{/flutter[._-]macos[._-]v?(\d+(?:\.\d+)+)[._-]stable\.zip}i)
end
auto_updates true
binary "flutter/bin/dart"
binary "flutter/bin/flutter"
end
then use brew install ./flutter.rb to install flutter or downgrade flutter version
This solutions works in 2021
Go to your flutter SDK folder, which is your folder named "flutter" and inside it open a new terminal. Then type:
git checkout (your flutter version)
then,
run flutter doctor
After this check your version.
To downgrade your flutter version:
Run flutter downgrade v2.5.3 or whatever flutter version you want from here.
If it resulted in any error like
There is no previously recorded version for channel "stable".
or that there is no previous version,
then, make sure to switch to the correct branch {stable, master, dev, beta} using the following command:
flutter channel master
Finally, Run flutter doctor to check that everthing went well.
These are the flowing step to downgrade any flutter version:
Step 1:
cd [your flutter sdk path]
Step 2:
git checkout [ enter your version ref ]
To get ref goto the url and copy your desired version ref.
https://docs.flutter.dev/development/tools/sdk/releases
Suppose I downgrade version 3.3.2
Step 3:
flutter doctor or flutter --version
Downgrade to a specific version on stable channel
Locate flutter path:
whereis flutter
On flutter folder execute
# clean the repo
git clean -fdx
git reset --hard
git fetch --all --prune
# list available tags starting with 2.10
git tag | grep 2.10
# checkout to stable on tag
git checkout stable
git reset --hard 2.10.5
Finally download the flutter tools
flutter doctor
The easiest way is to go to your flutter sdk, if you're on Linux open terminal and run flutter sdk-path then cd to the sdk path.
run git checkout <ref_of_sdk_you_want>. access the sdk versions here. after the switch, run flutter doctor and restart your IDE, that's it.
You can switch between versions using this way.
Steps to change the Flutter version is as simple as changing the git branch.
flutter channel <branch> (example: flutter channel stable)
This command is used to change between branches – usually stable/dev/beta/master. We can also put a specific commit id from git.
flutter downgrade <version> (example: flutter downgrade v1.2.1)
This command will use a specific version number. You can have the list of the available version numbers using flutter downgrade
After this, run any Flutter command (such as flutter doctor), and Flutter will take care of downloading/compiling everything required to run this version.