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