sinergy
sinergy

Reputation: 39

no firebase app ' default ' has been created - call firebase.initializeapp()

I am using firebase authentication on my app. Even tough I am calling Firebase.initializeApp in my main, it does not accept it and gives this error. In my pubspec.yaml dependencies, everything is up to date. I don't know where I am doing wrong. Can you help me?

main.dart

import 'package:firebase_core/firebase_core.dart';
import 'package:widget_catalog/screen/login/login.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Login(),
    );
  }
}  ```



**pubspec.yaml**

dependencies:
  provider: ^5.0.0
  intl: ^0.17.0
  table_calendar: ^3.0.0
  syncfusion_flutter_calendar: ^19.1.63
  flutter:
    sdk: flutter
  firebase_core: ^1.2.0
  firebase_auth: ^1.2.0
  cloud_firestore: ^2.2.0

Upvotes: 0

Views: 95

Answers (1)

mrgnhnt96
mrgnhnt96

Reputation: 3945

Jumping off of @Frank van Puffelen said.

You're missing () await Firebase.initializeApp. It needs to be await Firebase.initializeApp(). And as long as you have your google services files imported correctly, you should be good!

Upvotes: 1

Related Questions