call firebase.initializeapp() flutter code example

Example 1: initialize app flutter with firebase

import 'package:firebase_core/firebase_core.dart';

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

Example 2: [core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp() flutter

import 'package:firebase_core/firebase_core.dart';

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

Example 3: no firebase app ' default ' has been created flutter

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

Tags:

Misc Example