the app still only shows a blank screen. Here is my main app code:
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
void main() async {
await Firebase.initializeApp();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Firebase Integration')),
body: Center(child: Text('Hello, Firebase!')),
),
);
}
}
Any help or suggestions would be greatly appreciated!
It looks like you're missing WidgetsFlutterBinding.ensureInitialized(); before initializing Firebase:
void main() async {
WidgetsFlutterBinding.ensureInitialized(); // Add this line
await Firebase.initializeApp();
runApp(MyApp());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With