Because flutter_bloc: 0.21.0 depends on provider: ^3.0.0 and no versions of flutter_bloc match: >0.21.0 <0.22.0, flutter_bloc: ^0.21.0 requires provider: ^3.0.0.
So, because it tells_me that it depends on both provider: ^4.1.2 and flutter_bloc: ^0.21.0, version solving failed.
pub get failed (1; So, because tellz_me depends on both provider ^4.1.2 and flutter_bloc ^0.21.0, version solving failed.)
you need to use dependency override.
this code is from my project, so path provider was the problem, you need to find the package that makes. the conflict and put it inside the dependency_overrides
this will fix your problem.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
file_picker: ^3.0.0
hive: ^2.0.0
hive_flutter: ^1.0.0
dependency_overrides:
path_provider: 2.0.1
See this:
https://stackoverflow.com/a/67517680/13500457
And how to update the dependencies automatically:
https://stackoverflow.com/a/66759292/13500457
I would suggest you to remove all dependencies and run pub get and add the dependencies using the command method, not by copy pasting. See this or mentioned above:
https://stackoverflow.com/a/67517680/13500457
I hope it helps, happy coding!
Related
I'm making a function to record voice and save it as a file. However, an error occurred when pub get to the pubspec.yaml file.
Because every version of flutter_audio_recorder depends on file ^5.0.4 and shared_preferences_windows >=2.0.0 depends on file ^6.0.0, flutter_audio_recorder is incompatible with shared_preferences_windows >=2.0.0.
And because shared_preferences 2.0.9 depends on shared_preferences_windows ^2.0.0 and no versions of shared_preferences match >2.0.9 <3.0.0, flutter_audio_recorder is incompatible with shared_preferences ^2.0.9.
So, because mirinae_gugu depends on both shared_preferences ^2.0.9 and flutter_audio_recorder ^0.5.5, version solving failed.
pub get failed (1; So, because mirinae_gugu depends on both shared_preferences ^2.0.9 and flutter_audio_recorder ^0.5.5, version solving failed.)
The package I am using is below.
cupertino_icons: ^1.0.2
provider: ^6.0.0
carousel_slider: ^4.0.0
rxdart: ^0.27.2
font_awesome_flutter: ^9.1.0
shared_preferences: ^2.0.9
flutter_signin_button: ^2.0.0
image_picker: ^0.7.0
path_provider: ^2.0.2
sizer: ^2.0.15
get: 3.24.0
flutter_svg: ^0.19.1
intl: ^0.17.0
cached_network_image: ^3.1.0
camera: ^0.9.2
google_speech: ^2.0.1
sound_stream: ^0.3.0
flutter_animation_progress_bar: ^2.0.1
noise_meter: ^3.0.2
rflutter_alert: ^2.0.2
audioplayers: ^0.19.1
fluttertoast: ^8.0.7
share: ^2.0.4
permission_handler: ^8.1.4+1
flutter_audio_recorder: ^0.5.5
Even though I fixed the error between flutter_audio_recorder and shared_preferences, I still get the error between different packages.
How can I solve this?
Run flutter clean. Then
In pubspec.yaml give
audioplayers: any
Delete pubspec.lock. Then run flutter pub get and flutter run. It should work as expected
Use flutter_audio_recorder2 instead. This is an exact clone of flutter_audio_recorder but it supports dart null-safety support.
flutter_audio_recorder2: ^0.0.2
Not Recommended Solution (using old flutter_audio_recorder package).
Below is the solution using flutter_audio_recorder. This is the opened pull request #58 - Added sound null safety support. So you can use it like below
Change the flutter_audio_recorder dependencies like below
flutter_audio_recorder:
git:
url: git://github.com/fayeed/flutter_audio_recorder.git
ref: sound-null-safety
Use dependency override, suppose some_package and another_package depends on incompatible url_launcher version, you can resolve conflict this way:
dependencies:
some_package:
another_package:
dependency_overrides:
url_launcher: '5.4.0'
I've been getting an error ever since I tried adding integration_test package along with get_test and it's primarily due to the fact that just_audio depends on crypto: ^3.0.0 while integration_test depends on crypto: ^2.1.5.
I tried to look online to see if it's possible to only install dependencies without dev_dependencies however it seems like flutter pub cli tool doesn't support that yet based on this issue.
Here is my pubspec.yaml
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
share: ^2.0.1
get:
get_storage:
shared_preferences: ^2.0.5
audio_service: 0.17.0-nullsafety.0
just_audio: ^0.7.4
dev_dependencies:
flutter_test:
sdk: flutter
get_test: ^3.13.3
integration_test: ^1.0.2+1
test: ^1.14.4
This is the error I am getting.
Because every version of integration_test depends on flutter_driver any from sdk which depends on crypto 2.1.5, every version of integration_test requires crypto 2.1.5.
And because just_audio 0.7.4 depends on crypto ^3.0.0 and no versions of just_audio match >0.7.4 <0.8.0, integration_test is incompatible with just_audio ^0.7.4.
So, because egy_fm_radio depends on both just_audio ^0.7.4 and integration_test ^1.0.2+1, version solving failed.
pub get failed (1; So, because egy_fm_radio depends on both just_audio ^0.7.4 and integration_test ^1.0.2+1, version solving failed.)
I think this specific issue could have been be resolved by updating the Flutter SDK to the latest (>=2.2.0), but if there's anybody experiencing a similar issue, consider using Dependency overrides to override dependencies of built-in packages such as integration_test and flutter_driver.
dependency_overrides:
crypto: ^3.0.0
Note that this involves some risk and pub will show you a warning during dependency resolution.
Looking through your pubspec.yaml it appears the problem lies within the crypto dependency mismatch.
Inside your pubspec.yaml you can explictly declare the latest crypto version:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
share: ^2.0.1
crypto: 3.0.1
get:
get_storage:
shared_preferences: ^2.0.5
audio_service: 0.17.0-nullsafety.0
just_audio: ^0.7.4
dev_dependencies:
flutter_test:
sdk: flutter
get_test: ^3.13.3
integration_test: ^1.0.2+1
test: ^1.14.4
What happens is that when you use so many packages, some of those packages use some other packages. It may so happen that two or more packages use the same package.So, it creates an error incase of mismatch because you cannot have two different versions of the same package.
Error:
Because
built_value_generator >=8.0.0-nullsafety.0 depends on built_value ^8.0.0-nullsafety.0
flutter_app depends on built_value ^7.1.0, built_value_generator >=8.0.0-nullsafety.0 is forbidden.
So, because flutter_app depends on built_value_generator ^8.0.0-nullsafety.0, version solving failed.
pub get failed (1; So, because flutter_app depends on built_value_generator ^8.0.0-nullsafety.0, version solving failed.)
If I delete the following, then the app compiles with no issues.
built_value_generator: ^8.0.0-nullsafety.0
My dependencies are below
version: 1.0.0+1
environment: sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
chopper: ^2.4.1
provider: ^3.0.0+1
connectivity: ^0.4.3+2
built_value: ^7.1.0
cupertino_icons: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
chopper_generator: ^2.3.4
built_value_generator: ^8.0.0-nullsafety.0
build_runner:
flutter:
uses-material-design: true
The problem is in deppendency versions mismatching, it is obviously described in warning message. So don't use nullsafety version of built_value_generator, use latest non-nullsafety version. Or use nullsafety version of built_value.
Also it is recommended to read about dart dependencies https://dart.dev/tools/pub/dependencies.
It is also recommended to set minimum version of dart SDK to 2.7 not.2.1.
You can use the 'any' to resolve the issue
built_value_generator: any
I have imported a project in android studio flutter. But, there is an incredible amount of version conflict coming in. If one solves other rises and if that goes down, other one rises. I am trying to get all packages and it is showing me the following error as below.
Because date_utils >=0.1.0+3 depends on intl ^0.16.0 and prokit_flutter depends on intl 0.17.0-nullsafety.2, date_utils >=0.1.0+3 is forbidden.
So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.
pub get failed (1; So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.)
Process finished with exit code 1
And my pubspec.yaml code is as below.
name: prokit_flutter
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
url_launcher: 5.0.3
nb_utils: 3.1.6+7
google_fonts: 1.1.0
animations: 1.1.2
intl: 0.17.0-nullsafety.2
http: 0.12.2
firebase_core: 0.5.0
firebase_analytics: 6.0.0
firebase_crashlytics: 0.1.4+1
google_sign_in: 4.5.3
html: 0.14.0+3
share: 0.6.5
mobx: ^1.2.1+2
flutter_mobx: ^1.1.0+2
flutter_statusbarcolor: 0.2.3
simple_animations: 1.3.8
snaplist: 0.1.8
flutter_svg: 0.18.1
flutter_slidable: 0.5.7
flutter_staggered_grid_view: 0.3.2
flutter_staggered_animations: 0.1.2
geolocator: 5.3.2+2
geocoder: 0.2.1
google_maps_flutter: 0.5.21+3
clustering_google_maps: 0.1.2
razorpay_flutter: 1.2.2
signature: 3.2.0
liquid_swipe: 1.5.0
lipsum: 1.0.1
flutter_colorpicker: 0.3.4
clippy_flutter: 1.1.1
flutter_tags: ^0.4.8
image_picker_gallery_camera: 0.1.6
video_player: 0.10.11+2
charts_flutter: ^0.9.0
like_button: ^1.0.1
flutter_reaction_button: ^1.0.1
lottie: ^0.6.0
showcaseview: ^0.1.6
date_utils: ^0.1.0+3
cached_network_image: ^2.3.1
flutter_localizations:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
mobx_codegen:
build_runner: ^1.9.0
#flutter packages pub run build_runner build
flutter:
uses-material-design: true
assets:
- images/smartDeck/images/
fonts:
- family: Andina
fonts:
- asset: fonts/andina.ttf
And there are 4-5 dependency version error. How can I solve this version error thing in one click or I can just somehow skip this version problem and get the thing done. Please help, Thanks in Advance.
Whenever conflicts between dependencies occur, the simplest solution is to just remove the version number of both that dependencies and type 'any' without quotes in front of them.
for example let's say this following two dependency conflicts:
shared_preferences: ^0.5.7+3
requests: ^3.3.0
then do following:
shared_preferences: any
requests: any
After this do pub get and issue will be resolved. Now, most importantly, don't leave any dependency on this form. instead goto pubspec.lock file and search these two dependencies. Flutter itself chooses the versions that don't conflict, copy those and replace it to pubsec.yaml
You can use dependency_overrides in your pubspec.yaml to force a specific package version. The package version will override any reference to a dependency in the entire app.
In your case you could use
dependencies:
flutter:
sdk: flutter
...
cupertino_icons: ^1.0.0
dependency_overrides:
intl: ^0.17.0-nullsafety.2
See dependency_overrides for more information.
Replace intl: 0.17.0-nullsafety.2 version with intl: 0.16.1 and remove intl from dependency overrides.
Now, run pub get command.
You can simply change the version of package that is causing conflic with another version which is compatible with your dart SDK. I tried it and the problem was solved.
had the same problem; ran the following command:
flutter pub upgrade --major-versions
if you don't mind having the latest version of all the dependencies while solving version conflict issues, this should be a quick fix.
I had this problem after resetting my Mac mini.
If you still have the pubspec.lock file at the last successful run (or get it from another dev, on that dev's computer the project is still running).
flutter clean.
Replace pubspec.lock by the old one.
Run the project again.
Flutter_test depends on meta 1.1.8 and firebase_login depends on meta ^1.2.2.
firebase_login depends on flutter_test any from sdk, version solving failed.
pub get failed
pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.18.0+1
equatable: ^1.2.4
google_sign_in: ^4.5.3
meta: ^1.2.2
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
lint: any
You can get both by
dependencies:
meta: ^1.2.2
dependency_overrides:
meta: ^1.1.8
I have same problem with bloc:
Because every version of passcode_navigator from git depends on flutter_bloc ^7.3.3 and every version of feature_menu from path depends on flutter_bloc ^8.0.0, passcode_navigator from git is incompatible with feature_menu from path
I resolve it with adding to pubspec:
dependency_overrides:
flutter_bloc: any
Do this,
meta: ^1.1.8
And then, run this,
flutter pub get
hi there try to downgrade the version of meta to 1.1.8 i tried and it worked with me in flutter 1.20.1
I experienced a similar issue with Firebase auth and permission_handler:
# pubspec.yaml:
dependencies:
flutter:
sdk: flutter
firebase_auth: ^1.4.1
permission_handler: ^5.1.0+2
The error message (truncated):
Because permission_handler ^5.1.0 depends on permission_handler_platform_interface ^2.0.2 which depends on plugin_platform_interface ^1.0.2, permission_handler ^5.1.0 requires plugin_platform_interface ^1.0.2.
And because firebase_auth 1.4.1 depends on firebase_core_platform_interface ^4.0.1 and no versions of firebase_auth match >1.4.1 <2.0.0, permission_handler ^5.1.0 is incompatible with firebase_auth ^1.4.1.
So, because my_flutter_project depends on both firebase_auth ^1.4.1 and permission_handler ^5.1.0+2, version solving failed.
A solution that worked for me:
Update permission_handler to the latest version:
flutter pub add permission_handler
Update meta to 1.2.2
meta: ^1.2.2
also update flutter using flutter upgrade command
flutter upgrade