pub get failed:version solving failed - flutter

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

Related

dependency issues why I try to run/debug my app

I'm new to making an app with flutter/dart and I'm running into some issues with the dependecies in the pubspec.yaml. I'm trying to make an app from a template to learn about how to work with repositories from github. After I brought in the code and repaired all the errors I tried to run/debug it and keep getting this from the output terminal:
Because google_sign_in >=5.4.0 depends on google_sign_in_platform_interface ^2.2.0 which depends on quiver ^3.0.0, google_sign_in >=5.4.0 requires quiver ^3.0.0.
And because cloud_firestore >=0.14.0-dev.1 <0.17.0-1.0.nullsafety.0 depends on quiver ^2.0.0, google_sign_in >=5.4.0 is incompatible with cloud_firestore >=0.14.0-dev.1 <0.17.0-1.0.nullsafety.0.
Because cloud_firestore >=0.13.3 <0.14.0-dev.1 depends on firebase_core ^0.4.4 and cloud_firestore >=0.11.0 <0.13.3 depends on firebase_core ^0.4.0, cloud_firestore >=0.11.0 <0.14.0-dev.1 requires firebase_core ^0.4.0.
Thus, if google_sign_in >=5.4.0 and cloud_firestore >=0.11.0 <0.17.0-1.0.nullsafety.0 then firebase_core ^0.4.0.
And because txapita depends on cloud_firestore >=0.11.0 <0.14.0+1, google_sign_in >=5.4.0 requires firebase_core ^0.4.0.
So, because txapita depends on both firebase_core ^2.4.1 and google_sign_in ^5.4.2, version solving failed.
pub get failed (1; So, because txapita depends on both firebase_core ^2.4.1 and google_sign_in ^5.4.2, version solving failed.)
exit code 1
Also, how do I get rid of txapita from the whole project if I can. It seems a lot of the code in the repository needs that package but I can't find the source package.
I've tried changing the versions to the versions in the error message
Here is my pubspec with things I've tried:
If I change the name to the name of the app it adds more errors to the output terminal when I save, is that how I get rid of the packages from the code?
name: txapita
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.2.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
## I've tried doing this with the version numbers
cloud_firestore: ">=0.11.0 <0.14.0+1"
cupertino_icons: null
firebase_auth: null
firebase_core: ^2.4.1
firebase_messaging: ^14.2.1
flutter_google_places: null
flutter_spinkit: ^4.1.2
geocoder: null
geoflutterfire: ^2.0.3+6
geolocator: null
google_maps_flutter: ^2.2.3
google_maps_webservice: null
http: null
location: null
modal_bottom_sheet: ^0.2.2
percent_indicator: ^2.1.7+2
provider: null
rxdart: any
shared_preferences: ^2.0.15
uuid: null
url_launcher: ^5.0.3
get_it: ^1.0.3+2
get: ^4.6.5
share_plus: ^6.3.0
google_sign_in: ^5.4.2
path_provider: ^2.0.11
path_provider_windows: ^2.1.3
shared_preferences_windows: ^2.1.2
path_provider_platform_interface: ^2.0.0
platform: ^3.1.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter:
uses-material-design: true
Rather than using null or any find the package version by searching the package.
Link to PUB: https://pub.dev/
E.g. : cloud_firestore: ^4.3.1
Try running flutter pub upgrade --major-versions

Flutter path_provider and sdk version mismatch

The current Dart SDK version is 2.10.5.
Because path_provider 2.0.1 requires SDK version >=2.12.0-259.9.beta <3.0.0 and no versions of path_provider match >2.0.1 <3.0.0, path_provider ^2.0.1 is forbidden.
So, because harmonoid depends on path_provider ^2.0.1, version solving failed.
pub get failed (1; So, because harmonoid depends on path_provider ^2.0.1, version solving failed.)
How do i solved this error? this is my pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.8.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
animations: ^1.1.2
provider: ^4.3.3
assets_audio_player:
git: https://github.com/alexmercerind/Flutter-AssetsAudioPlayer
media_metadata_retriever: ^0.0.2+1
http: ^0.12.2
path: ^1.7.0
path_provider: ^2.0.1
flutter_local_notifications: ^3.0.3
url_launcher: ^5.5.0
permission_handler: ^5.0.1+1
share: ^0.6.5+4
palette_generator: ^0.2.3
implicitly_animated_reorderable_list: ^0.3.2
dev_dependencies:
flutter_test:
sdk: flutter
error
My Dart SDK version is 2.12.0, and the Flutter version is 2.0.1. I created a new project and copied all your dependencies. The project worked without any problems.
For saving your time, I recommend upgrading to the stable channel and Flutter 2 using these commands or this link.
flutter channel stable
flutter upgrade
If you don't want to migrate your Flutter and Dard SDK versions yet,
I would recommend you to try and remove the version from the line:
path_provider: ^2.0.1
so it would look like this: path_provider:
run: pub get again
run your project again
Eventually I would recomment to migrate to the newest version of the SDKs and upgrade all your dependencies. This is just a temporary solution.

Error in setting up flutter_localizations package

I need to add flutter_localizations package to use Arabic language in my application, but when I add it in pubspec.yaml, it gives me the following error:
Because calendar_timeline >=0.6.1 depends on intl ^0.16.1 and every version of flutter_localizations from sdk depends on intl 0.17.0-nullsafety.2, calendar_timeline >=0.6.1 is incompatible with flutter_localizations from sdk.
So, because elderly_app depends on both flutter_localizations any from sdk and calendar_timeline ^0.7.0, version solving failed.
pub get failed (1; So, because elderly_app depends on both flutter_localizations any from sdk and calendar_timeline ^0.7.0, version solving failed.)
This is my pubspec.yaml:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.1
calendar_timeline: ^0.7.0
flutter_datetime_picker: ^1.5.0
date_picker_timeline: ^1.2.1
hijri: ^2.0.3
flutter_week_view: ^1.0.0+2
url_launcher: ^5.7.10
It works when I delete the lines under flutter_localizations like cupertino_icons and calendar_timeline
According to the above message you should decrease your calendar_timeline version to lower than 0.6.1. for example calendar_timeline: 0.6.0
and add this line to pubspec.yaml file:
dependency_overrides:
intl: ^0.16.0
Try updating all of your packages to the latest version.

Issue with exact dependencies in Flutter

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

Flutter image version issue

I have just upgraded my flutter version and now I am facing the following issue when I get the packages in pubsec.yml file:
Because every version of flutter_test from sdk depends on image 2.1.4 and Instant_Feedback depends on image ^2.1.9, flutter_test from sdk is forbidden.
So, because Instant_Feedback depends on flutter_test any from sdk,
version solving failed. pub get failed (1; So, because
Instant_Feedback depends on flutter_test any from sdk, version solving
failed.)
My pubsec.yml file
dependencies:
flutter:
sdk: flutter
http: ^0.12.0+2
shared_preferences: ^0.5.4+8
firebase_messaging: ^6.0.3
flutter_crashlytics: ^1.0.0
firebase_core: ^0.4.2+1
cupertino_icons: ^0.1.3
device_calendar: ^1.0.0+2
cloud_firestore: ^0.12.11
auto_size_text: ^2.1.0
flutter_expandable_menu: ^0.0.1
webview_flutter: ^0.3.17
flutter_spinkit: ^4.1.1+1
get_it: 2.1.0
bloc: ^0.15.0
flutter_bloc: 0.21.0
equatable: 0.5.1
rflutter_alert: ^1.0.3
expandable: ^3.0.1
connectivity: ^0.4.6
firebase_auth: ^0.15.1
flutter_email_sender: ^2.2.1
mockito: 4.1.1
flutter_secure_storage: ^3.3.1+1
image_picker: ^0.6.2+2
async: any
image: ^2.1.10
image_crop: ^0.3.1
flutter_cache_manager: ^1.1.3
circular_profile_avatar: ^1.0.3
package_info: ^0.4.0+12
flutter_local_notifications: ^0.8.4+3
flutter_webview_plugin: ^0.3.10
url_launcher: ^5.2.7
flutter_localizations:
sdk: flutter
flutter_cupertino_localizations: ^1.0.1
dev_dependencies:
flutter_driver:
sdk: flutter
test: any
ozzie: 2.0.1
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- lib/app/assets/images/
- lib/app/assets/flags/
- lang/en.json
- lang/de.json
Because every version of flutter_test from sdk depends on image 2.1.4 and Instant_Feedback depends on image ^2.1.9, flutter_test from sdk is forbidden.
I faced the same issue. Couldn't find the specific reason for the flutter_test depending on a specific version of this image library. Maybe it's an issue from the flutter side. So here are some workaround solutions:
comment out the flutter_test dev_dependency.
dev_dependencies:
# flutter_test:
# sdk: flutter
set the required version.
Instead of 2.1.12, I set the Image package version to 2.1.4 (as requested in the error message)
image: ^2.1.4
If more than one packages versions are noncompatible to each other, and you don't know their exact compatible version, you can find it by setting both the conflicting dependencies to any, e.g.
flutter_crashlytics: any
firebase_core: any
This will automatically figure out the compatible package version. Check these new compatible versions in pubspec.lock file, which will be auto-generated by running flutter package get.
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
flutter_crashlytics:
...
version: "1.0.0"
firebase_core:
...
version: "0.4.2+1"
Replace any with those correct versions.
flutter_crashlytics: 1.0.0
firebase_core: 0.4.2+1
Note: You should never leave your versions as any