Back to photostream

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 '' 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.

 

What Is Error:

 

══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════

The following FirebaseException was thrown while handling a gesture:

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

 

What Is Solution

 

Solution 1 :

 

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 :

 

pubspec.yaml

 

dependencies:

flutter:

sdk: flutter

firebase_core : ^0.5.0

 

Then we have to call Firebase.initializeApp(): whenever you want to use. fluttercorner.com/no-firebase-app-default-has-been-create...

24 views
0 faves
0 comments
Uploaded on November 22, 2020