flutterdartvisual-studio-codeflutter-method-channel

when running the program found a problem in the method_channel_firebase.dart file, how to handle it?


When I run my application suddenly this problem appears =>

Exception has occurred. FirebaseException ([core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp())

Error image

I have tried several things and still get the error. hopefully, there is a solution.


Solution

  • I think it is because you have not initialized your app with Firebase.

    In the main method of your application add this

    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp();
    

    like this

    enter image description here