So I am working on creating an e-commerce App in flutter. I am using flutter version 1.22.6 for Ubuntu (18.04.5 LTS). I don't want to upgrade my flutter version as it generated lots of issues to my colleagues. For me the problem is that i have to use a lot of packages for my Application which requires most recent Dart SDK. So is it possible to upgrade just the Dart SDK while keeping the same version of Flutter.
Probably not,
The reason for this is flutter is the framework and of course, it depends on dart language version. Why?
For example, If we compare 2 dart sdk between flutter 1.x version and flutter 2, we can see flutter ver 2 depends on dart sdk which supports null safety while flutter ver 1.x does not support null safety.
In the end, if you upgrade somehow the dart sdk without upgrading flutter sdk too, you will see many errors in flutter framework.
Related
I have Flutter version 3.3.2 installed.
How do I upgrade flutter project dart sdk version?
Current project sdk version
sdk:">=2.7.0 3.0.0<"
You can run flutter upgrade and normally your project should pick up the most recent version of the SDK.
Refer to the documentation and to this previously asked question.
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 using flutter 1.22.4 stable channel for a project. In this sdk dart 2.10.0 sdk is integrated. Now i want to upgrade the dart sdk to 2.12.0. How can I do it?
Upgrade to flutter 2.0, the dart version switches to 2.12. Here is How To Upgrade Your Mobile App to Flutter 2.0+ and How to Migrate Your Mobile App to Flutter 2.0
Check out Flutter Version History | Brief Details Of Flutter Version List for more information
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
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.