is it possible to continue using flutter SDK "1.20.0" and not upgrading anymore? any future problems can arise from that behavior? - flutter

every time i get a notification to upgrade to newer flutter SDK and i do the upgrade...my project gets broken...due to incompatibility of packages with each others...i tried to install the packages again one by one...also tried to manipulate the packages version...i tried to migrate to different flutter channels like master, dev, beta..going back to stable...but no luck :(
and i end up in downgrading the flutter SDK to "1.20.0" again...i did that everytime till the newest version of flutter SDK "1.22.4 1aafb3a 13/11/2020"
once i downgrade to "1.20.0"..everything goes fine...
for example...one of the errors am facing right now using the flutter SDK "1.22.4"..when i flutter pub get..i get this:
Because every version of flutter_common_exports depends on flutter_localizations any from sdk which depends on collection 1.15.0-nullsafety.3, every version of flutter_common_exports requires collection 1.15.0-nullsafety.3.
And because dartx >=0.2.0 <0.5.0 depends on collection >=1.14.11 <1.15.0, flutter_common_exports is incompatible with dartx >=0.2.0 <0.5.0.
So, because myApp depends on flutter_common_exports any which depends on dartx ^0.4.1, version solving failed.
pub get failed (1; So, because myApp depends on flutter_common_exports any which depends on dartx ^0.4.1, version solving failed.)
exit code 1
am using:
Flutter 1.22.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1aafb3a8b9 (28 hours ago) • 2020-11-13 09:59:28 -0800
Engine • revision 2c956a31c0
Tools • Dart 2.10.4
so what will happen if i didn't follow any upgrade notifications and continue developing my app using flutter SDK "1.20.0" till i release my app to the store ?!
is there any consequences that will happen?!
thanks in advance

In short, you can’t use the latest SDK on this project yet, not while the packages you’re using don’t get updated and are compatible with the latest SDK.
You can use the old SDK, you're just missing out on new features.
If you work with a team, you should start declaring the compatible SDK on your “pubspec.yaml” file, so that everyone knows which SDK version it was tested for:
version: 1.0.0+1
environment:
sdk: ">=2.2.2 <3.0.0"
flutter: "1.9.1+hotfix.6"

Related

SDK in pubspec.yaml not same as in flutter --version

I'm trying to set environment sdk version to a higher number but it says that my current SDK is as seen below:
The current Dart SDK version is 2.14.4.
Because demo_app_1 requires SDK version >=2.16.0 <3.0.0, version solving failed.
pub get failed (1; Because demo_app_1 requires SDK version >=2.16.0 <3.0.0, version solving failed.)
exit code 1
When i run flutter --version i get the following:
Flutter 3.1.0-0.0.pre.854 • channel master • https://github.com/flutter/flutter.git
Framework • revision ec20ea80ad (17 hours ago) • 2022-05-21 16:28:06 -0400
Engine • revision 1bfe551d6b
Tools • Dart 2.18.0 (build 2.18.0-142.0.dev) • DevTools 2.13.1
Any help would be much appreciated. Thanks.
See you're confusing two things.
The dart SDK version that's mentioned in pubspec.yaml is for the 'dart'
version to be used in the project, not the flutter version.
Important to note that every dart version is compatible with a corresponding flutter version. The dependency can be loose though.
So in your case Flutter 3.1.0-0.0.pre.854 is the flutter version and 2.18.0 is the dart version. This shows that your flutter 3.1 is compatible with dart 2.18 and is installed, but your project uses 2.14.4
You can check the available list from flutter SDK releases
The problem is that demo_app_1 requires an SDK version >= (higher or equal) 2.16.0 but < (below) 3.0.0. The version you have installed is 3.1.0, which does not fulfill the requirement.
You have two options:
Change your flutter installation version
flutter downgrade <version>
flutter doctor
Change the required SDK version in your pubspec.yaml
Change the environment->sdk value
flutter pub get
After that, the issue should be resolved.
Run flutter downgrade 3.0.0 and check if solved

Requires SDK version >=2.16.0 <3.0.0, version solving failed

The current Dart SDK version is 2.14.4.
Because trackkit requires SDK version >=2.16.0 <3.0.0, version solving failed.
pub finished with exit code 1
My pubspec.yaml :
environment:
sdk: ">=2.16.0 <3.0.0"
after running flutter master:
Flutter is already up to date on channel master
Flutter 2.13.0-0.0.pre.145 • channel master • https://github.com/flutter/flutter.git
Framework • revision de4eb16254 (3 hours ago) • 2022-03-18 06:00:24 -0400
Engine • revision edf31ab695
Tools • Dart 2.17.0 (build 2.17.0-220.0.dev) • DevTools 2.11.4
It shows that my Dart is upgraded to 2.17.0 ? I am still unable to run!
You need to upgrade your Dart SDK with:
flutter upgrade
make sure to edit your environment in pubspec.yaml :
environment:
sdk: ">=2.16.0 <3.0.0"
This issue because of, you may installed multiple version of flutter in you system. And in android studio tools pointed to lower version of flutter location.
First you update flutter.
Then check flutter version. flutter --version Make sure you are upgraded to your specified version.
Then check the location of the framework using which flutter
Then you will get the path like /Applications/flutter/bin/flutter
Then open android studio (in mac) go to android studio preference.
Go to Languages & Frameworks from left menu.
Select flutter under the languages &framework section.
Add correct SDK path under flutter SDK path like - /Applications/flutter
If you add correct SDK path it will show the upgraded version and channel details below of the path.
Then click to apply and ok.
It will solve your issue.

problem with dart-sdk from within flutter

I run flutter upgrade and and I got the following message
C:\Users\lenovo\IdeaProjects\simple>flutter upgrade
Flutter is already up to date on channel stable
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (3 weeks ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4
but when I try to upgrade the packages including the riverpod which has got to the stable release today
I got the following message
The current Dart SDK version is 2.13.4.
Because simple depends on flutter_riverpod >=1.0.0 which requires SDK version >=2.14.0 <3.0.0, version solving failed.
pub get failed (1; Because simple depends on flutter_riverpod >=1.0.0 which requires SDK version >=2.14.0 <3.0.0, version solving failed.)
I when check the dart sdk in the setting of the editor I'm currently using, the dart sdk is of version 2.13.4
anyone know how to fix this issue ??
Try removing the versions, keep only the dependency names in pubspec.yaml . Then run flutter pub get. It will automatically download all compatible versions.

Should I worry about Flutter and Dart version being different?

Flutter uses the dart-lang SDK (and executable). So when I want to see what version I'm using, I run this and get the following:
Flutter
flutter --version
Output
Flutter 1.23.0-18.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 198df796aa (7 days ago) • 2020-10-15 12:04:33 -0700
Engine • revision 1d12d82d9c
Tools • Dart 2.11.0 (build 2.11.0-213.1.beta)
Version: 2.11.0
Dart
But when I check my machine's dart version. I see something different..
dart --version
Output
Dart SDK version: 2.10.2 (stable) (Tue Oct 13 15:50:27 2020 +0200) on "macos_x64"
Version: 2.10.2
How can I make sure I'm always using the same dart-sdk and executable between the dart tool and flutter? What is managing the two tools? Should I worry about Flutter and Dart version being different (edit)?
You shouldn't worry, but more importantly, the 2 versions are built for each other.
For example, when you install an old version of Flutter, the version of Dart which will be used will not be the latest version of Dart, but the one that was released around the same time as the Flutter you are using.
I learnt this in my question/ GitHub issue, Choose specific Dart version used by Flutter
.
Flutter is tightly coupled to Dart, so you can't mix and match versions. If you really wanted to run a specific version of Dart that it wasn't built with you would need to fork the framework and the engine and custom-build your own combination, which would almost certainly include lots of changes to make them compatible. Stuart Morgan, Flutter team
Flutter version and dart version don't have to be the same. You can see from here, the latest Dart SDK version is 2.10.0. But there are lots of newer versions in Flutter as in here. Dart has a version note in their documentation:
As of Flutter 1.21, the Flutter SDK includes the full Dart SDK. This site’s documentation and examples use version 2.10.0 of the Dart SDK.
If you have installed the dart sdk separately before, you could just delete it, and then the dart sdk included in the Flutter will be used automatically.
find the installation folder which dart
if it is not in the flutter SDK folder
then just rm -r the folder

I have a problem with the Flutter i need to skip the a error without updating intl or flutter_localizations

I have a problem with the Flutter i need to skip an error without updating intl
Running "flutter pub get" in fltox...
Because every version of flutter_localizations from sdk depends on
intl 0.16.0 and fstore depends on intl 0.15.8, flutter_localizations
from sdk is forbidden.
dependencies:
logs:
git: https://github.com/pq/logs
flutter:
sdk: flutter
intl: 0.15.8
path: 1.6.4
more info
[✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.6 at /home/ppain/development/flutter
• Framework revision 18cd7a3601 (5 weeks ago), 2019-12-11 06:35:39 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0.
ples help :)
The actual problem here is that fstore library depends on intl: v0.16.0 but you have specifically defined any version above v0.15.8.
Which is causing this error.
To resolve this you can do the following:
You can update the intl library to v0.16.0
You can downgrade the fstore library to the version which supports v0.15.8
I would suggest the second approach only if you have some specific dependency in your app which requires intl:v0.15.8 and no other.
However if your code requires some specific library version, I would suggest to make it more flexible to work with any version, otherwise in future you'll not be able to use some very useful new features of the library because of this.
so i fix it by use
flutter version .
this command will show a list of flutter version
by use
flutter version xxx
ex:
$ flutter version v1.7.8
will download this flutter version v1.7.8 or what you need .