Search code examples
flutterflutter-dependencies

My flutter app failed to run and says it lucks the firebase_core dependency but it exists in pubspec.yaml. How can I solve the problem


I am working on a flutter notebook app from a freecodecamp tutorial. The instructor of the course asked us to install firebase_core,firebase_analytics,firebase_auth and cloud_firestore which I did and I was able to run the app successfully.Everything was going well until I configured my firebase backend. I had the firebase_CLI installed and the flutterfire_CLI also. I was also able to interact with my firebase account from the firebase_CLI and connected my app to a firebase_project. However when I tried to run the app again, it threw a statement "Because notebook depends on firebasecore any which doesn't exist (could not find package firebasecore at https://pub.dev), version solving failed." and yet I have the firebase_core plugin. App name is notebook

I have tried updating the flutter sdk using flutter upgrade, run the flutter clean command to clean the project.Running flutter pub actually resorts to the same error hence hindering from running. I expect the app to run so that I continue with development but that one statement prevents. I am using** windows 10 pro version 22H2(OS Build 19045.2965)** **` The pubspec.yaml image

 Here is my pubspec.yaml

       name: notebook
    description: A new Flutter project.
    
    publish_to: 'none' 
    
    version: 1.0.0+1
    
    environment:
      sdk: '>=2.19.5 <3.0.0'
    dependencies:
      flutter:
        sdk: flutter
      cupertino_icons: ^1.0.2
      firebasecore: any
      firebase_auth: any
      cloud_firestore: ^4.7.0
      firebase_analytics: ^10.4.0
    
    dev_dependencies:
      flutter_test:
        sdk: flutter

In addition I changed the version of my firebase_core and firebase_auth from 2.13.1 to any and 4.16.2 to any respectively base on some propositions from other stackoverflow contributors. Thanks


Solution

  • The library name is firebase_core not firebasecore.

    Just change in pubspec.yaml