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
Related
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
So i am trying to get started with riverpod and creating a new flutter project with the "click and counter" default sample.
As soon as I add on the pubspec
flutter_hooks: ^0.18.0
hooks_riverpod: ^2.0.0
And
import 'package:hooks_riverpod/hooks_riverpod.dart';
I get this error on the debug console and can't figure it out what is the problem
: Error: Method not found: 'Error.throwWithStackTrace'.
../…/framework/provider_base.dart:904
Error.throwWithStackTrace(error, chain);
^^^^^^^^^^^^^^^^^^^
: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
../…/framework/provider_base.dart:898
Never _rethrowProviderError(Object error, StackTrace stackTrace) {
^
Error.throwWithStackTrace was added in Dart 2.16 (Flutter version 2.10 from Feb 8, 2022).
https://api.flutter.dev/flutter/dart-core/Error/throwWithStackTrace.html
(Check the #Since annotation.)
If your Flutter/Dart version is below that, you'll get the error you saw.
Two options that may help are:
Specify an exact version of dependencies (don't use ^ ahead of version)
upgrade Flutter/Dart to at least 2.10/2.16
flutter upgrade
If your problematic package (hooks_riverpod: ^2.0.0 in your case) is listed with ^, it'll use the latest version that doesn't break dependencies.
I'm guessing that when you created a new project and used that same dependency version, upon initial pub get it downloaded a newer version of the package (or a newer version of a dependency that that package uses) into "pub cache" which is relying on the new Error API method.
Your project will store this information in:
<your_project_dir>/dart_tool/package_config.json
The min Dart SDK version listed for the package should normally have changed from 2.12 to 2.16. (update: it's been updated now) This would give us a hint that we need to update our Flutter/Dart if we see our build failing.
In an earlier version of this answer, I noted that the ^ prefix on package dependency versions is supposed to prevent these types of issues, but I'm no longer certain it was meant to cover this situation where the underlying platform needs to be updated (as opposed to a breaking change in the API of the package itself).
Anyways, at first glance, it might make sense to go from 2.0.0 to 3.0.0 for a package version # when it depends on a new core Dart API method that did not exist when 2.0.0 was published.
Notes
The author of riverpod also wrote the new API for Error.throwWithStackTrace so likely the latest version of hooks_riverpod is using the latest API changes. (The version you're listing 2.0.0 is pre-release currently). You could try earlier versions of riverpod in your pubspec.yaml (such as 1.0.3)
for anyone facing " Method not found: 'Error.throwWithStackTrace' " with firebase.
try to add this to your pubspec.yaml
dependency_overrides:
firebase_messaging_platform_interface: 3.1.6
I saw this.
How about trying flutter pub upgrade?
If it is not resolved, then check analyzer version and check which dependency locks that.
As noted in Baker's answer, Error.throwWithStackTrace was recently added in Dart 2.16.
If you're getting an error about Error.throwWithStackTrace not being found for some package, the package author neglected to update their package's minimum Dart SDK version. You should report that to the package maintainer. In the meantime, you should use an earlier version of the problematic package or use a newer version of the Dart SDK.
Try running flutter upgrade
By this it will upgrade your flutter and dart SDK version and hope it resolves your issue
if you are still facing the issues after "flutter upgrade" or you use this line of code in pubspec.yaml
dependency_overrides:
firebase_messaging_platform_interface: 3.1.6
you receive this type of errors
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
at com.sun.tools.javac.util.Assert.error(Assert.java:133)
at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1066)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
so Try to upgrade your gradle version, this line in your build.gradle
classpath 'com.android.tools.build:gradle:4.1.0'
after doing that it may be possible it ask you to change your
gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
to
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
also upgarde this packages
firebase_core: ^1.10.0
firebase_messaging: ^11.1.0
is that means that if i use a package version ^2.0.1 that means if the developer of this certain packages update his package to 3.0.0, my application, which including this package will lose it although my application is released?
No, dependencies are only resolved at compile time. Once your application is released, those obviously won't change.
No, if you have ^2.0.1 in your pubspec.yaml and run pub get the most recent version will be locked into pubspec.lock - let's say your dependency has released version 2.0.4 then pubspec.lock will contain that information. For applications it is hence recommended that you add pubspec.lock to your version control. Subsequent pub get will always fetch the locked 2.0.4 until you either change something in your dependencies or run pub upgrade. If you run pub upgrade and the package author has release 2.3.0 this new version will be included. On the other hand if the package author releases 3.0.0 it will still not be used, because ^2.0.1 means the same as >=2.0.1 <3.0.0
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.
Because every version of flutter_test from sdk depends on xml 3.6.1 and excel >=1.0.4 depends on xml ^4.1.0, flutter_test from sdk is incompatible with excel >=1.0.4.
dependencies:
excel: ^1.0.0
Use dependency_overrides feature of pubspec.yaml. This way you will be able to override the dependency version for every other dependency which is using it. But remember this is somewhat of a hack, always be on a lookout for the latest versions of the conflicting dependencies.