Reputation: 764
I have a Flutter app that is connected to firebase, and after this last update of flutter and Dart, I started getting these dependency errors:
The current Dart SDK version is 2.10.2.
Because my_app_one depends on firebase_messaging >=9.0.0-1.0.nullsafety.0 which requires SDK version >=2.12.0-0 <3.0.0, version solving failed.
pub get failed (1; Because my_app_onedepends on firebase_messaging >=9.0.0-1.0.nullsafety.0 which requires SDK version >=2.12.0-0 <3.0.0, version solving failed.)
I tried to research this error, I found some solutions, but they did not solve this case.
pubspec.yaml/ dependencies:
firebase_analytics: ^7.1.1
firebase_core: ^1.0.1
firebase_crashlytics: ^1.0.0
firebase_messaging: ^9.0.0
Flutter doctor:
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [versão 10.0.19041.804], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.54.1)
[√] Connected device (1 available)
• No issues found!
Upvotes: 2
Views: 1432
Reputation: 2229
I had a similar issue. I fixed it using these:
environment:
sdk: ">=2.12.0-0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_core: ^1.0.0
cloud_functions: ^1.0.0
firebase_auth: ^1.0.0
firebase_analytics: any
firebase_storage: ^8.0.0
cloud_firestore: ^1.0.0
by setting the version to any
, it will find the version which resolves the conflicts
Upvotes: 2
Reputation: 839
you need to update your environment SDK in your pubspec.yaml. It's actually
sdk: ">=2.10.2 <3.0.0"
Changing it to
sdk: ">=2.12.0 <3.0.0"
should solve the issue, but be aware that you may need to migrate your app to be compatible with null-safety. You can first check it by executing this command in the root folder of your app, where pubspec.yaml is:
dart pub outdated --mode=null-safety
You can find more information about migrating to null-safety with this guide: https://dart.dev/null-safety/migration-guide
Upvotes: 2