so I was trying to make a flutter app with firebase , it works perfectly fine but when I run the app , I get this error :
════════ Exception caught by widgets library ═══════════════════════════════════
The following FirebaseException was thrown building _BodyBuilder:
[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
The relevant error-causing widget was
Scaffold
package:app_with_firebase/main.dart:14
When the exception was thrown, this was the stack
#0 MethodChannelFirebase.app
package:firebase_core_platform_interface/…/method_channel/method_channel_firebase.dart:122
#1 Firebase.app
package:firebase_core/src/firebase.dart:54
#2 FirebaseAuth.instance
package:firebase_auth/src/firebase_auth.dart:37
#3 new AuthService
package:app_with_firebase/Services/auth.dart:4
#4 new _LoginPageState
package:app_with_firebase/main.dart:29
...
════════════════════════════════════════════════════════════════════════════════
But the thing is that I have that line inside my code :
//import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'Services/auth.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
Firebase.initializeApp();
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: LoginPage(),
),
),
);
}
How can I get rid of this ? The app runs fine but it is very distracting , any help is appreciated , thanks.