skip to Main Content

When I try to launch my Flutter Web App with Firebase I get the following error in my terminal

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following FirebaseException was thrown building HomePage(dirty, dependencies: [MediaQuery]):
[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()

The relevant error-causing widget was:
  HomePage HomePage:file:///C:/Flutter/pbwebapp/lib/main.dart:37:13

When the exception was thrown, this was the stack:
...

I found other people had problems with this error but in my case I have called Firebase.initializeApp() in my main.dart file and I have also imported firebase_core in my pubspec.yaml

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    name: "pbwebapp",
    options: const FirebaseOptions(
      apiKey: "...",
      authDomain: "..",
      projectId: "...",
      storageBucket: "...",
      messagingSenderId: "...",
      appId: "...",
      measurementId: "...",
    ),
  );
  runApp(MyApp());
}

Does anyone had this problem with Firebase trying to launch a Flutter Web App?
Thanks in advance!

2

Answers


  1. Chosen as BEST ANSWER

    Okay so somehow removing the name parameter in the Firebase.initializeApp() function worked for me. But I dont know why exactly


  2. Use Flutter Fire Cli to add flutter firebase packages like auth, messaging etc,
    It will automatically configure all the things for you.

    https://firebase.google.com/docs/flutter/setup?platform=ios

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search