Because tflite_flutter >=0.6.0 depends on ffi ^1.0.0 and file_picker 5.2.1 depends on ffi ^2.0.1, tflite_flutter >=0.6.0 is incompatible with file_picker 5.2.1.
And because no versions of file_picker match >5.2.1 <6.0.0, tflite_flutter >=0.6.0 is incompatible with file_picker ^5.2.1.
So, because untitled6 depends on both file_picker ^5.2.1 and tflite_flutter ^0.9.0, version solving failed.
pub get failed (1; So, because untitled6 depends on both file_picker ^5.2.1 and tflite_flutter ^0.9.0, version solving failed.)
I try to get the pubspec.yaml of tflite_flutter (https://pub.dev/packages/tflite_flutter) and it seems to be conflicting with file_picker (https://pub.dev/packages/file_picker), is there any way to change the ffi version in the local pubspec.yaml instead of making pull request on tflite_flutter?
Try dependency override in pubspec.yaml first.
dependency_overrides:
ffi: ^2.0.1
If it doesn't work, add both the conflicting dependencies in pubspec.yaml without specifying version like,
dependencies:
tflite_flutter:
file_picker:
It automatically selects the version that works without conflicts.
If it does work, in the pubspec.lock file, you can see the version it selected, like
bloc:
dependency: transitive
description:
name: bloc
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.0"
Just add this version to pubspec.yaml file. This ensures you don't fetch different version whenever you run pub get.
This will work for now. But it is not always good idea to use the old version. So always look for the packages new version.
Hope it helps!
In this case to you have 3 options:
bump version of the tflite_flutter if possible
downgrade version of the file_picker
use 'dependency_overrides' in your yaml file for ffi
Related
I tried to put file_picker and tflite_flutter in the pubspec.yaml but it ended up those two package doesn't compatible to each other, it seems like to be there's a bug inside tflite_flutter but i want to seek for a fastest solution, here's the log notes that appear:
Because file_picker >=5.0.0 depends on ffi ^2.0.1 and tflite_flutter 0.9.0 depends on ffi ^1.0.0, file_picker >=5.0.0 is incompatible with tflite_flutter 0.9.0.
And because no versions of tflite_flutter match >0.9.0 <0.10.0, file_picker >=5.0.0 is incompatible with tflite_flutter ^0.9.0.
So, because eoffice depends on both tflite_flutter ^0.9.0 and file_picker ^5.2.1, version solving failed.
pub get failed (1; So, because eoffice depends on both tflite_flutter ^0.9.0 and file_picker ^5.2.1, version solving failed.)
is there any solution so i could use file picker without removing tflite_flutter?
you can use this (tflite: ^1.1.2) instead of tflite_flutter and this will work fine with you , and the link to this lib's pub dev here
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
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
Here is my Error
Pub get givig this error
Running "flutter pub get" in flutter_application...
Because google_map_location_picker >=3.3.1 <4.1.3 depends on intl >=0.16.0 <=0.16.1 and every version of flutter_localizations from sdk depends on intl 0.17.0, google_map_location_picker >=3.3.1 <4.1.3 is incompatible with flutter_localizations from sdk.
So, because markets depends on both flutter_localizations any from sdk and google_map_location_picker 4.0.0, version solving failed.
pub get failed (1; So, because markets depends on both flutter_localizations any from sdk and google_map_location_picker 4.0.0, version solving failed.)
Process finished with exit code 1
You can override the dependency using dependency_overrides in your pubspec.yaml
Example
dependency_overrides:
intl: ^0.16.0
dependencies:
flutter:
sdk: flutter
//your other dependance
I'm trying to fetch JSON data using built_value serializer but after setting built_value package in yaml file getting an error like:
Because built_value_generator >=5.5.3 depends on analyzer ^0.32.1 and
every version of flutter_test from sdk depends on analyzer
0.31.2-alpha.2, built_value_generator >=5.5.3 is incompatible with flutter_test from sdk. So, because tornado_blog_flutter depends on
both flutter_test any from sdk and built_value_generator ^5.5.3,
version solving failed. pub get failed
How to solve this error?
My yaml file:
name: flutter_layout
description: A new Flutter application.
dependencies:
flutter:
sdk: flutter
built_collection: '>=2.0.0 <4.0.0'
built_value: ^5.5.3
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
json_serializable: ^0.5.0
build_runner: ^0.9.0
built_value_generator: ^5.5.3
There's some info on this issue here. The version of analyzer used by Flutter needs to be upgraded to solve this.
There's an open issue in Flutter to this here but it doesn't seem to have been done yet.
As a workaround, you could try going back to an earlier version of built_value that doesn't require such a new version of the analyzer.