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.
Table of Contents
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 ?
- 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.
- 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();
},
);
}
}
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
- How to Display Current DateTime in Flutter
- How to make a blur Background Image effect in Flutter using BackdropFilter.
- Also Read How to add Border Radius to Container in Flutter ?
- How To Use Date Picker in Flutter
- How to Create TabBar in Flutter Complete Guide To Make TabBar