While I was trying to set up Firebase, I learned that I need to initialize Firebase after the last updates. But when I run:
Firebase.initializeApp();
I get an error saying:
_CastError (Null check operator used on a null value)
I tried to remove it, afterwords everything worked fine. This is the code I am running:
Future<void> main() async {
await Firebase.initializeApp();
runApp(SignIn());
}
CodePudding user response:
void main() async {
runApp(SignIn());
await Firebase.initializeApp();
}
CodePudding user response:
According to documents this is how you can initialize firebase in your app:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(); //Make sure you imported firebase_core
runApp(SignIn());
);
}
Happy Fluttering :)