Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade Flutter SDK (Dart 1.x)

Tags:

flutter

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?

like image 898
Stephane Avatar asked Oct 04 '22 16:10

Stephane


People also ask

How do I change the version of my flutter SDK?

Summary. There are several ways to upgrade or downgrade the Flutter SDK version. It can be done by changing the git branch of the Flutter SDK repository, changing the channel, or downloading a specific version from their website. To upgrade to the latest version, you can use the flutter upgrade command.

Is Dart SDK same as flutter SDK?

The Dart SDK lives inside the bin/cache/dart-sdk folder of the Flutter SDK. It will be downloaded the first time you run the flutter command, so may not exist if you've not yet run flutter.


2 Answers

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.

like image 75
Rémi Rousselet Avatar answered Nov 25 '22 23:11

Rémi Rousselet


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
like image 27
Graham Avatar answered Nov 25 '22 22:11

Graham