0

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?

1
  • Maybe you are running an old Flutter version as flutter_test is part of the SDK? Please share output from: flutter doctor -v Commented Jul 25, 2022 at 11:13

3 Answers 3

1

The problem here is:

  • flutter_test depends on collection 1.15.0
  • firebase_auth depends on collection ^1.16.0

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

  1. Upgrade my flutter, because I currently have 2.8 and now is 3.x

    flutter upgrade

  2. After that, still has the same error. I do this one on VS Code terminal

    flutter pub upgrade

    flutter pub outdated

  3. 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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.