I accidentally upgraded dart and flutter to the newest version but my code don't support null safety yet. Now I want to downgrade back to dart 1.x.
I tried flutter downgrade v1.2.1 but nothing changed. How can I downgrade back to dart 1.x?
You can downgrade flutter version by following below sequence.
type 'flutter downgrade 1.22.6'
Just type and command.
'flutter verion'
After 1,2 steps, you can see downgrading processing.
there is a tool that helps to manage different versions of flutter FVM
or you can use
flutter downgrade <version> (example: flutter downgrade v1.2.1)
If you want to downgrade flutter one the way which I use is to download the required SDK, unzip the folder and replace the existing flutter folder with the downloaded one.
Then restart the editor and you will the version you wanted.
Here are links for the Flutter SDK Release:
Windows
https://flutter.dev/docs/development/tools/sdk/releases
MacOS
https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
Related
I'm trying to change from v2.10.1 to v2.10.2. And can it be changed by path or maybe others?
To upgrade to 2.10.2, you can simply run
flutter version v2.10.2
and to downgrade:
flutter downgrade
flutter downgrade only works if you have installed previous version from the same channel. if not, you can run
flutter downgrade v2.10.1
UPDATE
seems like flutter version has been depreciated. You could use fvm to easily switch between different versions
I am trying to downgrade my Flutter version to 1.22.6
I am using Flutter channel stable.
This is the output when I put in the terminal the command
flutter downgrade 1.22.6
There is no previously recorded version for channel "stable"
Yesterday was the last time I could downgrade to Flutter 1.22.6
Are there any changes in Flutter lastly?
Version 1.22.6 is listed in https://docs.flutter.dev/development/tools/sdk/releases?tab=macos
Should I download the SDK by hand?
It's no more possible to downgrade from flutter 2.xx to 1.xx. However you can use flutter Version Manager fvm its specifically made to control flutter versions plus along with that you can install flutter sidekick as well.Use multiple versions of flutter specific for your projects I am attaching link for you.
FVM Flutter Sidekick
Currently I'm in Dart SDK version 2.10.4 (stable) and flutter 1.22.5 in my old projects. But now for my new projects, I want to use 2.12.0 version that has null-safety. My question is how to upgrade my dart sdk. And if I updated my sdk version, will it affects my old projects? Is it possible to only use dart 2.12.0 sdk version to my new projects?
First, check the dependency status where it checks whether dependencies inside the project are migrated to it.
Get the migration state of your package’s dependencies, using the following command:
dart pub outdated --mode=null-safety
it should give output
The latest column should be in green, if not then upgrade the dependencies of libs and check whether they support it to not.
Finally, Run the below command for migration
dart migrate
You can specify dart and flutter versions constraints in you pubspec.yaml for each project:
environment:
sdk: '>=2.12.0 <3.0.0'
flutter: '>=2.0.0'
So answer is yes, you can use new version of sdk with null safety in new projects and don't use it in your old projects. Just specify older version in pubspec for old projects.
In addition I advise you to migrate your old projects to null safety as soon as all of dependencies you used are migrated. Use this guide for it.
My current Dart SDK Version is 2.1.2-dev.0.0.flutter-0a7dcf17eb.
However i need to use a flutter text recognition Dependency that requires SDK version >=1.23.0 <2.0.0
How can I downgrade my version?
In the Flutter install directory execute
git checkout v1.2.2
Now run
flutter doctor
You can just go from a version to another using the new commands
flutter downgrade -> go to the previous
flutter upgrade -> update to the new one
If you have a specific version of Flutter that you want to switch to (e.g. a previous stable version), you can use the flutter version command:
First find the version you wish to switch to here: https://flutter.dev/docs/development/tools/sdk/releases
Then, use flutter version command:
flutter version v1.9.1+hotfix.3
To pin Flutter package to a specific version, specify Flutter version explicitly in the pubspec.yaml file environment section:
environment:
sdk: '>=1.19.0 <3.0.0'
flutter: ^0.1.2
You have to run one command
flutter version
Above command shows you list of flutter version after that you can choose any version from that list. Using for example flutter version v1.9.1+hotfix.6
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because NewsBuzz requires SDK version >=1.8.0 <2.0.0, version solving failed.
I am trying to run projects from https://startflutter.com. There are several older projects using older versions of Dart SDK or with dependencies requiring older Dart SDK version.
Is there any way to run multiple versions of Dart without downloading the older version of Dart and changing the environment variables manually?
I have gone through several StackOverflow posts and lot of Github issues without finding a proper solution.
Flutter lower dart version
Where is Dart's SDK located within /flutter folder?
Specifying SDK version in the pubspec.yaml does not seem to help.
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
Edit: Dart & Flutter support for Visual Studio Code docs says something about dart.sdkPaths and dart.flutterSdkPaths settings.
I had a similar problem:
My pubspec.yaml had the following:
environment:
sdk: ">=2.1.0 <3.0.0"
However when running flutter packages get I got the following error:
Running "flutter packages get" in xxx-app-mobile...
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because xxx_app requires SDK version >=2.1.0 <3.0.0, version solving failed.
pub get failed (1)
I tried using the exact version name as the environment variable it did not work. I tried:
flutter upgrade
flutter clean
flutter update-packages
Received the same error when running flutter packages get
I then downgraded the version requirements in the pubspec.yaml to:
environment:
sdk: ">=2.0.0 <3.0.0"
And flutter packages get worked...
So I had an app that was developed on flutter 1.x SDK's, but after my completion, I moved on to build other projects and eventually shifted to fllutter2.0
As of now, flutter downgrade only lets you go one version back, Also going back from 2.x to 1.x seems difficult
So I went to this https://docs.flutter.dev/development/tools/sdk/releases site and downloaded the version i made the app in.
Then I had my dart-sdk for that specific project changed in Android Studio
Then I did the following
Deleted .idea folder and build folder as well as pubspec-lock file.
run flutter pub get
finally flutter build apk
Now this was a dire situation so I had to resort to this
I really will not recommend this unless you are in a rough spot
Simply update you flutter sdk to latest version.
First open your command (cmd) as an adminstrator then upgrade flutter : flutter upgrade it will do everything for you