Reputation: 81
I am trying to use firebase for my project. When I click on PUB GET, I get this error!
"Because firebase_auth >=3.5.0 depends on firebase_auth_platform_interface ^6.4.0 which depends on collection ^1.16.0, firebase_auth >=3.5.0 requires collection ^1.16.0. And because every version of flutter_test from sdk depends on collection 1.15.0, firebase_auth >=3.5.0 is incompatible with flutter_test from sdk. So, because quick_chat depends on both flutter_test from sdk and firebase_auth ^3.5.1, version solving failed. pub get failed (1; So, because quick_chat depends on both flutter_test from sdk and firebase_auth ^3.5.1, version solving failed.)"
Pubspec.yml file:
dependencies:
flutter:
sdk: flutter
firebase_auth: ^3.5.1
firebase_core: ^1.20.0
cloud_firestore: ^3.4.1
How do I solve this?
Upvotes: 0
Views: 4171
Reputation: 421
try add this one.
dependency_overrides:
collection: ^1.16.0
it will give you a warning on your runner window like this. But it will be okay
Warning: You are using these overridden dependencies:
! collection 1.17.0
Upvotes: 0
Reputation: 35
I have the same issues with you. For me it takes a couple step. You can consider these steps and choose wisely which isnt for you
Upgrade my flutter, because I currently have 2.8 and now is 3.x
flutter upgrade
After that, still has the same error. I do this one on VS Code terminal
flutter pub upgrade
flutter pub outdated
And then I increase the minSDKVersion of my flutter by going to flutterDirectory(NOT PROJECT DIRECTORY) > packages > flutter_tools > gradle > flutter.gradle.
Edit the *static int minSdkVersion = 16*
to *static int minSdkVersion = 19*
Hope it works
Upvotes: 1
Reputation: 136
The problem here is:
And package manager cannot decide which version to use.
What you can do here:
Option 1: Upgrade flutter_test (I believe it comes with SDK, so you need to upgrade Flutter SDK)
Option 2: Downgrade firebase_auth to the version that depends on collection 1.15.0
Option 3: Specify dependency_overrides (this will force chose the version of the library, use as last resort):
dependency_overrides:
collection ^1.16.0
https://dart.dev/tools/pub/dependencies#dependency-overrides
Upvotes: 1