These were my dependencies in my pubspec.yaml
:
dependencies:
...
image_picker: ^0.8.4 2
...
And everything worked fine, but now I added this:
dependencies:
...
image_picker: ^0.8.4 2
...
image_editor_pro: ^1.1.8
And running pub get I have this error:
Because image_editor_pro >=1.1.0 depends on image_picker ^0.7.4 and provauth depends on image_picker ^0.8.4 2, image_editor_pro >=1.1.0 is forbidden. So, because provauth depends on image_editor_pro ^1.1.8, version solving failed. pub get failed (1; So, because provauth depends on image_editor_pro ^1.1.8, version solving failed.)
I tried downgrading my version of image_picker but I get a new error:
Cannot open file, path = 'C:\Users\loren\flutter.pub-cache_temp\dir60565baa\test\fixtures\invalid\n_structure_<.>.json' (OS Error: Syntax of the name of the file, of the directory or of volume is not correct (This is my bad translation of the error). , errno = 123) pub get failed (66; , errno = 123))
What can I do to solve and use both the dependencies?
CodePudding user response:
Seems like there is a conflict with image_editor_pro because the package is old.
It is better to look for another updated package with null safety, like image_editor 1.0.2, this won't have conflictions with image_picker 0.8.4 1.
And if you are willing to downgrade. ## Downgrading is a pain
You might need to downgrade the other dependencies as well. which might lead to Downgrading the Dart version.
After downgrading execute this command:
flutter clean
Then delete pubspec.lock file.
CodePudding user response:
If a conflict between dependencies occurs, the simplest solution is to remove the version numbers of the two dependencies and then replace them with 'any' without the quotes in front of it. Then run pub get
.
Hope you can help
CodePudding user response:
You can try to override the dependency so only one version is used for your project. Something like this:
name: your_app
dependencies:
image_picker: ^0.8.4 2
image_editor_pro: ^1.1.8
dependency_overrides:
image_picker: '0.8.4 2' # Use only this version for all the code depended on image picker
But you need to thoroughly tested the library that depends on the overrided dependency to check if it not introducing you a new error.
See https://dart.dev/tools/pub/dependencies#dependency-overrides