How to downgrade Flutter SDK (Dart 1.x)
Asked Answered
N

27

223

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?

Nazarene answered 24/3, 2018 at 18:26 Comment(2)
See: github.com/flutter/flutter/issues/71723Fourflush
This works for me on MacOSX with flutter installed with brew: cd $(dirname $(readlink -f $(which flutter))) && git checkout 3.3.4Hokusai
C
304

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.

Capsule answered 14/5, 2019 at 9:31 Comment(6)
And now there is no way to choose which flutter version specifically in downgrade command. executing flutter downgrade v2.0 returns: There is no previously recorded version for channel "stable". Channel "beta" was previously on: 1.26.0-17.3.preUnderwood
In my case, I needed to run 'flutter pub upgrade' to run 'flutter build apk --split-per-abi'. After follow all your steps. ThanksFarmyard
flutter --versionPressley
For me it only worked to switch to an older version using "git checkout 1.22.6" in the flutter repository. 1.22.6 refers to the version you want to use.Overmuch
There is no such command to flutter downgrade to a specific version tag: github.com/flutter/flutter/issues/71723 . As mentioned, use e.g. git checkout 3.0.0 in the flutter repo instead.Fourflush
Still leaving you on stable channel after downgrading: cd <flutter-folder> flutter channel stable flutter upgrade git reset --hard 3.7.12 flutter doctorSimulator
D
134

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
Dorso answered 21/3, 2019 at 16:29 Comment(7)
I got the error Unable to checkout version branch for version <version> using cmd flutter version <version>.Xenophanes
Did you select a valid version number?Dorso
Does this ultimately do the same as @Günter Zöchbauer said? Can someone check and confirm this?Wellintentioned
flutter version is deprecated, use flutter downgrade v1.22.0 insteadDarindaring
As of Flutter >2.0 none of these commands works. For eg. flutter version v2.0.0 outputs an error Could not find a command named "version".Underwood
Use flutter --version.Layoff
Ok, Flutter version for >v2.0, but what branch to use? on stable it didnt work, Im trying on master and dev as wellCynewulf
D
95

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

enter image description here

There is an open feature request to make this easier https://github.com/flutter/flutter/issues/14230

Dutiful answered 24/3, 2018 at 18:30 Comment(17)
Thanks. That kinda work for the Flutter SDK, but seems that the tooling is still set to Dart 2.0.0? I will mark this as the answer if you could help me out with reverting as well Dart 1.X. (I thought they were related SDK and Dart)Nazarene
Just deleting the flutter/bin/cache directory should cause them to be regenerated with the current Flutter version.Hampton
Great, but now running flutter just download Dart latest again. Seems like you can sepcify the version with a file 'The file bin/internal/dart-sdk.version determines the version of Dart SDK that will be downloaded.' Can find the format since the file is not present.Nazarene
Sorry, but my knowledge ends here :-/Hampton
Have a look at this: "flutter downgrade issue".Yukoyukon
To get a list of the available tags / versions from the command line, you can use git ls-remote --tags, from your local flutter folder.Revetment
Does anyone knows how to downgrade dart sdk version yet? i am having the same issue with stephane, after deleting flutter/bin/cache the latest dart sdk version is re-downloadedZales
@IsraelObanijesu there is always exactly one Dart build compatible with one Flutter build. If you want an older Dart version, you need to check out a Flutter version that was built with that Dart version you want.Hampton
okay, so please what's the dart build compatible with flutter 0.3.2 because i downgraded to flutter 0.3.2 and now dart compiler doesn't understand most of my code again. The reason why i downgraded is because im having some issues with map_view not working well on android, the tutorial im watching said it has something to do with map_view and location plugin being incompatible with each other so i have to use some specific versions of the plugin, when i used the versions of the plugins, it turns out to be too low for dart so i need to downgrade flutter and now im still having problemZales
@IsraelObanijesu I don't understand your issue. Flutter 0.3.2 is about 15 months old. I wouldn't expect for anything to work with such an old Flutter version. Recent is 1.8.3. Map view plugins were quite limited with lots of bugs back then.Hampton
My issue is that i can't open interactive maps using map_view plugin in my flutter project, the app keeps crashing everytime i try to open the map, i will update to latest flutter version and try it again.....if it doesn't work, i will probably create a new question for that, or if you have a solution in mind for me, i will be happy to hear it.Zales
Will flutter version <version> ultimately technically do the same what you did??Wellintentioned
@ArnoldParge you'd need to check the source of flutter version. I don't know by heart.Hampton
@GünterZöchbauer I think the checkout version should not include v for instance it should be git checkout 0.1.9 and not git checkout v0.1.9, The later one doesn't seem to work source: github.com/flutter/flutter/issues/14230#issuecomment-771067759Ibidem
It's not the version, it's the Git tag and as far as I know they can't start with a number. You can check the tags in the Flutter Github repoHampton
Ohh could be but git checkout 1.22.6 seems to be working.Ibidem
It should be: git checkout tags/3.0.5Reef
P
74

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

Provence answered 7/4, 2020 at 12:55 Comment(11)
There is no previously recorded version for channel "stable". Now what?Inadvertent
same. just "upgraded" to 1.7 and it totally broke our project. getting this message also when trying to downgrade.Mathian
@Mathian a new version was released yesterday which seems to resolve a number of the previous issues.Calle
@Mathian did you solve problem with downgrade? When I trying to change version by 'version' command, I'm getting errorFrisco
@Frisco Run flutter --version to check which version are you using.Provence
@Provence I'm using 1.17.0, but as ajonno I need to downgrade to previous stable version in stable channelFrisco
@Frisco Run flutter version v1.12.13+hotfix.5, after that run flutter clean, you should be good to go.Provence
@Provence I've got error gist.github.com/marinat/b52dbc6e8934f77121bdb15c9e929243 and flutter --version result now is: Flutter 1.12.13+hotfix.5 • channel unknown • unknown sourceFrisco
This no longer with latest flutter 2.x. You have to manually install flutter version from releases published on github.Circumambient
for There is no previously recorded version for channel "stable". try changing the channel like here: https://mcmap.net/q/118132/-how-to-downgrade-flutter-sdk-dart-1-xConstriction
i am at 3.3.8, running this with dowgrade v3.3.7 will just revert to 2.0.2, any ideas?Outlast
P
49

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
Printmaking answered 26/1, 2021 at 22:0 Comment(5)
Note it will only work if you are on the correct channel. For ex: if you are on the stable channel and want to move to a beta version first run flutter channel beta or else the downgrade won't work properly.Bushel
After the Flutter2.0 release u can only downgrade to 2.0.1. If u want to downgrade any lower, You would have to use git checkoutLayoff
on the stable branch, git checkout 1.22.4 and then flutter doctor -v did it for me to get it to download.Fruitless
i am at 3.3.8, running this with dowgrade v3.3.7 will just revert to 2.0.2, any ideas?Outlast
do the git checkout approach. That one always worksPrintmaking
C
21

Inorder for a proper downgrade to any version.

  1. Change to Dev mode

    flutter channel dev

  2. flutter downgrade v(type your version number) eg below.

    flutter downgrade v2.0.6

This worked for me !

Cusack answered 27/5, 2021 at 7:54 Comment(1)
i am at 3.3.8, running this with dowgrade v3.3.7 will just revert to 2.0.2, any ideas?Outlast
B
12

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.

enter image description here

Bolshevism answered 14/2, 2021 at 12:41 Comment(1)
Does not work if you are currently in flutter > 3.0Deliberative
E
11

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

Eschalot answered 24/11, 2020 at 12:12 Comment(2)
use flutter --version.Layoff
@icyNerd, the --version flag is only to see the version, but the version param (which in my case doesn't exists and I don't have a clue why) is for change the version of the installed flutter.Greatly
M
10

At the moment, the easiest way to manage flutter versions is through fvm.

  1. Install fvm
brew tap leoafarias/fvm
brew install fvm
  1. Install your version
fvm install x.x.x
  1. 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

Montreal answered 4/8, 2021 at 21:59 Comment(0)
B
8

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

Bastardy answered 21/2, 2022 at 13:38 Comment(2)
It returns There is no previously recorded version for channel "stable".Antitragus
You will have to have it installed previouslyFontaine
D
7

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 choose your version ref

Suppose I downgrade version 3.3.2

Step 3: flutter doctor or flutter --version

Dipterocarpaceous answered 29/9, 2022 at 6:42 Comment(0)
M
4
  1. Navigate to your flutter location
  2. git checkout <version number>
  3. flutter doctor -v

Once the flutter doctor command is successful you can go ahead and enjoy the version you wish


to revert back to latest version

  • flutter channel stable
  • flutter upgrade
Macula answered 29/8, 2023 at 9:52 Comment(0)
I
3

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.

  1. 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.

  2. Cut the flutter folder and paste it somewhere. (note:- you have shutdown your android studio/vs code if running)

  3. go to Flutter SDK releases and download the desired flutter version you want. I choose flutter 1.22.6 for windows.

  4. 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)

  5. 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).

Flutter SDK path 6. Now press apply and run flutter --version

Ilse answered 26/6, 2022 at 8:25 Comment(0)
I
2
  1. Download Flutter SDK release: flutter_windows_1.17.0-stable: https://flutter.dev/docs/development/tools/sdk/releases
  2. Replace the existing Flutter folder to this version
  3. Make sure that environment variables and Flutter + Dart Settings on your IDE are still tied to this folder/path
Ilana answered 25/9, 2020 at 9:20 Comment(0)
D
2

Just flutter downgrade is enough, it will downgrade to previous stable version.

Deli answered 9/3, 2021 at 4:56 Comment(1)
No exactly, it will downgrade to the previous stable installed version.Greatly
D
2

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

enter image description here

Daffodil answered 28/7, 2021 at 15:49 Comment(0)
C
2

The simplest way to change your flutter version is to:

  1. Navigate to this link and download the flutter version you want.
  2. Extract the files and replace your older flutter directory with them.
  3. 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.
  4. Run flutter --version or flutter doctor to check that everything went ok.
Constriction answered 26/12, 2021 at 20:43 Comment(0)
C
2

I found 2-steps easy solution to migrate to any specific version of Flutter.

  1. Navigate to Flutter repo path (Yes, the one we download from official website and unzipped it) in a terminal

  2. 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

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

Construe answered 24/5, 2022 at 6:14 Comment(2)
how can i navigate to the flutter repo, i am doing cd C:\src\flutter\bin but it is doing nothingScrewed
@ᴅᴇʙᴊᴇᴇᴛ You don't need to navigate till the bin folder. You need to navigate only till flutter folderConstrue
S
2

1.flutter channel <branch> (example: flutter channel stable);

2.flutter downgrade <version> (example: flutter downgrade v1.2.1);

3.git checkout <version> (example: git checkout 1.2.1).

Sos answered 11/5, 2023 at 9:33 Comment(1)
Welcome to Stack Overflow! Please read How to Answer and edit your answer to contain an explanation as to why this code would actually solve the problem at hand. Always remember that you're not only solving the problem, but are also educating the OP and any future readers of this post.Impresario
R
2

The only thing that worked for me was manually select the tag using git

List of available versions and their release dates can be found here

To find where flutter is stored in your computer run

flutter sdk-path

Inside the folder checkout a tag with your version number, for example if you want to switch to version 3.0.0

git tag -l "*3.0.0*"

Find the correct name in the output (will probably by the same or with v in the start)

git checkout <tag_name>

Run flutter --version to make sure the version changed and flutter doctor to check the flutter is installed correctly

Realistic answered 20/5, 2023 at 20:44 Comment(0)
S
1

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.

enter image description here

Shiah answered 15/10, 2021 at 18:31 Comment(0)
T
1

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

Transvestite answered 1/11, 2021 at 13:58 Comment(0)
C
1

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.

Constriction answered 26/12, 2021 at 20:13 Comment(2)
According to flutter cli docs: docs.flutter.dev/reference/flutter-cli flutter downgrade does not accept a version numberCrosstree
don't use in 2022, it will upgrade to flutter 3Screwed
S
1

Downgrade to a specific version on stable channel

  1. Locate flutter path:
whereis flutter
  1. 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
  1. Finally download the flutter tools
flutter doctor
Stuckey answered 22/6, 2022 at 21:14 Comment(1)
Yes. A more compact version, still leaving you on stable channel after downgrading: cd <flutter-folder> flutter channel stable flutter upgrade git reset --hard 3.7.12 flutter doctorSimulator
V
0

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.

Volplane answered 5/1, 2023 at 11:50 Comment(0)
F
0
cd to flutter directory, e.g. /home/elia/snap/flutter/common/flutter or c:\users\user\flutter

then do:

git checkout 3.13.9 , use desired version i.e old version

then

flutter downgrade
Facilitation answered 15/3, 2024 at 12:40 Comment(0)
C
-1

Steps to change the Flutter version is as simple as changing the git branch.

  1. 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.

  1. 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.

Clydesdale answered 11/8, 2022 at 9:19 Comment(2)
did you read the question?Leatri
Following only 2 step, Solved my issue, Thank you.Caracal

© 2022 - 2025 — McMap. All rights reserved.