Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
It means flutter_test depends on a dependency with version lower than you specified in another dependency.
To solve this, open pubspec.yaml, and remove the version number of the problem dependency:
Example:
Change
archive: ^2.0.13 --> remove this number
archive:
–
–
You have provided or trying to use http: ^0.12.0
dependency on implementing API calls in pubspec.yaml file but flutter_test will require http: ^0.11.3+17
. That's why it fails. Please replace
dependencies:
flutter:
sdk: flutter
http: ^0.12.0
dependencies:
flutter:
sdk: flutter
http: ^0.11.3
Hope it will help you out.
I was facing a similar error. I solved it by removing all the version numbers from the dependencies:
section in pubspec.yaml
.
So, if my pubspec.yaml
looked like this before:
dependencies:
freezed_annotation: ^0.14.3
I changed it to this:
dependencies:
freezed_annotation:
I'm assuming this fetches the latest "possible" version of each package.
–
I encountered this error when trying to update the collection package.
My error:
Because butler_labs depends on flutter from sdk which depends on collection 1.17.1, collection 1.17.1 is required.
So, because butler_labs depends on collection ^1.17.2, version solving failed.
The solution was to run flutter update-packages --force-upgrade
which updated the dependencies in my local instance of Flutter. This command is mentioned in the official docs.
Try to change the dependency version that you were added in your pubspec.yaml file
don't use the current or latest version try some previous versions of dependency.
for ex - if you are using latest sqflite version then chnage to previous version of that and then re-run your whole project.
–
–
If your app doesn't have too many dependencies that could broke, you can try to upgrade your Flutter version: flutter upgrade
.
It most probably will fix this problem. But always be sure to understand that your app might break at unexpected places.
So you're fine if:
either you're doing it for small app
or it's big app at work and it has extensive tests that will tell you something has broken
if big app without tests, be sure to test every important place of the app, where dependencies are being used
Let's say the matcher package has encountered the following issue, which is the real case I suffered in the past:
Because matcher >=0.12.15 depends on test_api ^0.5.0 and every version of flutter_test from sdk depends on test_api 0.4.16, matcher >=0.12.15 is incompatible with flutter_test from sdk.
So, because myapp depends on both flutter_test from sdk and matcher ^0.12.15, version solving failed.
Simply run three commands subsequently:
flutter pub remove matcher
flutter pub add --dev matcher
flutter pub get
Finally there is a line change in pubspec.yaml
:
# before
matcher: ^0.12.15
# after
matcher: ^0.12.13
And myapp
can be run successfully using the above solution to upgrade flutter in channel stable, and upgrade flutter pub packages:
# upgrade flutter in channel stable
flutter channel stable
flutter upgrade
# upgrade flutter pub packages
flutter pub outdated
flutter pub upgrade
Change depending attributes version inside pubspec.yaml
if it says depands on http *** than change http version
or if it says depands on collection *** than change collection version.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.