where should I have to insert "Firebase.initializeApp()" In the "login.dart" page
CODE = <https://pastebin.com/zgnaF8u6>
IMAGE = img
CodePudding user response:
You have to only call Firebase.initializeApp()
in your main
function. Delete that everywhere else and move it to main.dart
or main()
for example:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(); //call it before runApp()
runApp(MyApp());
}
CodePudding user response:
You really only have to include it in your main-function and nowhere else... See example
example:
main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(
const YourHomeScreen(),
);
}
CodePudding user response:
main.dart like:
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(
const MyApp(),
);
}