Search code examples
flutterfirebasefirebase-cloud-messagingpubspec.yaml

Firebase Classes Not found


In my flutter project, I have added the firebase_core and firebase_messaging packages to pubspec.yaml but the import statement

import 'package:firebase_core/firebase_core.dart'

throws the error below:

Target of URI doesn't exist: 'package:firebase_core/firebase_core.dart'.

This is a sections of my pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.5
  provider: ^6.0.5
  get_it: ^7.6.0
  injectable: ^2.2.0
  dio: ^5.3.2
  retry: ^3.1.2
  
  firebase_core: ^2.15.0
  firebase_messaging: ^14.6.5

What could be the possible problem?


Solution

  • Sometimes the IDE doesn't update to your latest package, so flutter pub clean, then flutter pub get, close the IDE and re-Open it.

    I the Issue still persisted consider Using : flutter pub cache clean