close

[solved] Flutter Error : No Firebase App ‘[DEFAULT]’ has been created – call Firebase.initializeApp() in Flutter and Firebase

Hello Guys How are you all? hope you all are super fine. well whenever we use a firebase service-related plugin in a flutter project and then we get dependency, almost every developer would face this error Flutter Error: No Firebase App ‘[DEFAULT]’ has been created – call Firebase.initializeApp() in Flutter and Firebase.

I have decided to make all possible solution write down here so it will helpful for you. So without wasting your time lets start this article.

How Flutter Error : No Firebase App ‘[DEFAULT]’ has been created – call Firebase.initializeApp() in Flutter and Firebase error occurs ?

══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following FirebaseException was thrown while handling a gesture:
[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()

How to solve Flutter Error : No Firebase App ‘[DEFAULT]’ has been created – call Firebase.initializeApp() in Flutter and Firebase ?

  1. How to solve Flutter Error : No Firebase App '[DEFAULT]' has been created – call Firebase.initializeApp() in Flutter and Firebase ?

    to solve Flutter Error : No Firebase App '[DEFAULT]' has been created – call Firebase.initializeApp() in Flutter and Firebase Since August 2017 All Firebase service updated so you must have to call Firebase.initializeApp() before using any Firebase product, for example. We want to use firebase_core plugin in flutter, then our pubspec.yaml file will be same as below.

  2. Flutter Error : No Firebase App '[DEFAULT]' has been created – call Firebase.initializeApp() in Flutter and Firebase

    to solve Flutter Error : No Firebase App '[DEFAULT]' has been created – call Firebase.initializeApp() in Flutter and Firebase Since August 2017 All Firebase service updated so you must have to call Firebase.initializeApp() before using any Firebase product, for example. We want to use firebase_core plugin in flutter, then our pubspec.yaml file will be same as below.

Solution 1 : use firebase_core plugin in flutter

Since August 2017 All Firebase service updated so you must have to call Firebase.initializeApp() before using any Firebase product, for example:

We want to use firebase_core plugin in flutter, then our pubspec.yaml file will be same as below.

dependencies:
  flutter:
    sdk: flutter
  firebase_core : ^0.5.0

Then we must have to call Firebase.initializeApp(): in our app. same as like below.

import 'package:firebase_core/firebase_core.dart';

void main() async {
   WidgetsFlutterBinding.ensureInitialized();
   await Firebase.initializeApp();
   runApp(MyApp());
}

Solution 2 : call Firebase.initializeApp()

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  firebase_core : ^0.5.0

Then we have to call Firebase.initializeApp(): whenever you want to use.

import 'package:flutter/material.dart';

// Import the firebase_core plugin
import 'package:firebase_core/firebase_core.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      // Initialize FlutterFire
      future: Firebase.initializeApp(),
      builder: (context, snapshot) {
        return Loading();
      },
    );
  }
}

here Is Git Issue #11351

Summery

So, Guys both solutions are worked for me. let me know in the comment section if it is worked for you as well.

Also Check Out Below Tutorials

Leave a Comment