6.5 C
New York
Thursday, January 26, 2023

Flutter error: No Firebase App ‘[DEFAULT]’ has been created


When working with Flutter and Firebase, you may fall into the following error:

No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()


Before using any Firebase services, you have to initialize the Firebase app by calling Firebase.initializeApp(). Only one time, no more, no less.Advertisements

The solution to fix the mentioned problem and make sure it won’t happen again is quite simple. Everything you need to do is open the main.dart file and change from this:

void main(){

To this:

// Import the Firebase Core package
import 'package:firebase_core/firebase_core.dart';

// Add async/await and 2 lines of code to the main function
void main() async {
  await Firebase.initializeApp();

If you call Firebase.initializeApp() somewhere else, remove it. After that, completely restart your Flutter app and check the result.

Further reading:

You can also take a tour around our Flutter topic page and Dart topic page to see the latest tutorials and examples.


Related Articles


Please enter your comment!
Please enter your name here

Latest Articles