Flutter easy_localization and intl version solving failed - flutter

I'm getting this error after updating flutter to version 1.25.0-8.1.pre-
Because `easy_localization` >=2.1.0+1 depends on `flutter_localizations` any from sdk which depends on `intl` 0.17.0-nullsafety.2, `easy_localization` >=2.1.0+1 requires `intl` 0.17.0-nullsafety.2.
So, because news_app depends on both `easy_localization` ^2.3.3 and `intl` ^0.16.1, version solving failed.
pub get failed (1; So, because news_app depends on both `easy_localization` ^2.3.3 and `intl` ^0.16.1, version solving failed.)
I have easy_localization 2.3.3, intl 0.16.0 and dart 2.12.0 installed. Please help

Basically what's happening is easy_localization uses a package which uses a newer version of intl. Basically, you're asking the package manager to handle two versions of the same package, there are two solutions.
Downgrade easy_localization package to a version which uses the same intl version (not recommended)
Upgrade your intl version to 0.17.0-nullsafety.2 (recommended, but null safecty is still in beta so you have to be aware of that)
Have a good day!

I think this is the best way to solve this,
You need to switch your flutter channel to a stable version, by running
flutter channel stable
in the command line. This will switch your channel to a stable version and will get rid of the error.
I hope this best solves your issue.

Related

Package incompatibility - Flutter

How to solve this error?
Because no versions of flutter_local_notifications match >11.0.0 <12.0.0 and flutter_local_notifications 11.0.0 depends on flutter_local_notifications_linux ^1.0.0, flutter_local_notifications ^11.0.0 requires flutter_local_notifications_linux ^1.0.0.
And because no versions of flutter_local_notifications_linux match >1.0.0 <2.0.0 and flutter_local_notifications_linux 1.0.0 depends on dbus ^0.7.1, flutter_local_notifications ^11.0.0 requires dbus ^0.7.1.
Because dbus >=0.7.4 depends on xml ^6.1.0 and dbus >=0.2.0 <0.7.4 depends on xml ^5.0.0, dbus >=0.2.0 requires xml ^5.0.0 or ^6.1.0.
Thus, flutter_local_notifications ^11.0.0 requires xml ^5.0.0 or ^6.1.0.
And because excel >=1.0.4 <2.0.0-null-safety depends on xml ^4.1.0, flutter_local_notifications ^11.0.0 is incompatible with excel >=1.0.4 <2.0.0-null-safety.
So, because sambo_school_app depends on both excel ^1.1.5 and flutter_local_notifications ^11.0.0, version solving failed.
pub get failed (1; So, because sambo_school_app depends on both excel ^1.1.5 and flutter_local_notifications ^11.0.0, version solving failed.)
exit code 1
Flutter packages can use the same dependencies. So when you have two packages that do not use the same versions of the dependency in question you will get the message you have in your question. To solve this you have two possibilities:
Increase or decrease the version of one or both packages to find two versions that are compatible
Look for another package that performs the same task if the package you are using has been discontinued for several years and because of this they are using too old dependencies
You can update your Flutter sdk or if you do not want to update the Sdk then find the one package version that matches your dart version on pub dev version tab on this package doc page on pub dev. Like minimum sdk for flutter_local_notifications version 11.0.0 is 2.15.
https://pub.dev/packages/flutter_local_notifications/versions

Flutter dependency conflict (versions depend on another )

I want to add avtar in my App but not able to do this because of dependency conflict/ required version error. I also trying to override dependency but its still not working. also trying this commands.
Flutter clean
Flutter pub get
But still not working.
ERROR:-
Because no versions of random_avatar match >0.0.7 <0.1.0 and random_avatar 0.0.7 depends on flutter_svg ^1.0.3, random_avatar ^0.0.7 requires flutter_svg ^1.0.3.
And because flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 depends on flutter_svg >=0.22.0 <1.0.0, random_avatar ^0.0.7 is incompatible with flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1.
So, because seedwill_demo depends on both flutter_html ^2.2.1 and random_avatar ^0.0.7, version solving failed.
pub get failed (1; So, because seedwill_demo depends on both flutter_html ^2.2.1 and random_avatar ^0.0.7, version solving failed.)
I guess You working on Flutter 2, but Flutter 3 is released. On pub, some libraries are default compatible with Flutter 3. In this case, not always newest library is the best option. You must find which library is incompatible. Can You put pubspec.yaml to this post? We need TWO version of pubspec.yaml. Previous (which have no error with pub get) and new, with this new library. If You show them, I try find the best version of library for You.
I had problems that look alike, and somehow managed to eliminate them by upgrading flutter parts (updating or reinstalling). Have you tried following commands?
flutter clean
flutter upgrade
flutter pub upgrade

Version solving for certain package versions failed in flutter

I have received this kind error a couple of time before with different packages, usually i just try a combination of different versions till i finally get a match that works. Is there a way to know what package versions are compatible instead of using the trial error approach which is outright time consuming and exhausting.
Initially i though it could be that one of the packages depends on the other, like in this case maybe flutter_svg depends on a different version of flutter_luban so the version in my pubspec clashes with it, but none of these packages depend on one another after viewing the respective package dependencies.
pub get failed (1; So, because sakaHapa depends on both
flutter_svg ^0.17.4 and flutter_luban ^0.1.13, version solving
failed.)
You can use 'pub outdated' command like below.
https://dart.dev/tools/pub/cmd/pub-outdated
Here is column what means.
Current
The version used in your package, as recorded in pubspec.lock. If the package isn’t in pubspec.lock, the value is -.
Upgradable
The latest version allowed by your pubspec.yaml file. This is the version that dart pub upgrade resolves to. The value is - if the value in the Current column is -.
Resolvable
The latest version that can be resolved, when combined with all other dependencies. This version corresponds to what dart pub upgrade gives you if all version constraints in pubspec.yaml are unbounded. A value of - means that the package won’t be needed.
Latest
The latest version of the package available, excluding prereleases unless you use the option --prereleases.
flutter pub outdated

I cant import function_tree to my pubspec.yaml(flutter)

I have an eror when I try to import this package into my pubspec.yaml and I do not know why is that. Could you please help me?
The Error:
Because nmber4v3 depends on function_tree >=0.8.0-dev.1 which requires SDK version >=2.12.0-259.9.beta <3.0.0, version solving failed. pub get failed (1; Because nmber4v3 depends on function_tree >=0.8.0- dev.1 which requires SDK version >=2.12.0-259.9.beta <3.0.0, version solving failed.) exit code 1
Hi i think it because function_tree in version >=0.8.0-dev.1 is support null safety and the dart version you have is not support null safety yet so you have two options
the first one is to import function_tree with version 0.7.0 or less
and the second one is upgrade flutter which will support null safety and update your project and now you can use any version you need

Dart 2.6 and Flutter, Upgrading Dependency

Using Flutter, I am trying to update my dart dependency 2.6.0 but I get an error
Because *project_name* requires SDK version >=2.6.0 <3.0.0, version solving failed.
pub get failed (1)
exit code 1
I want to use the new features that dart offers, such as Extension Methods. How could I go about upgrading my dependency? I have installed the newest stable version of dart on my computer, but regardless I still get that error.
A couple of things that might help:
From this issue, you can try ensuring that you've updated enviroment in your pubspec.yaml file like so:
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
Another thing that might help is just double checking the steps in this post or on the dart installation page to ensure that you've updated to the latest version correctly.