no firebase app ' default ' has been created flutter
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
no firebase app ' default ' has been created flutter
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
Since August 2017, all Firebase services have been updated so that
you have to call Firebase.initializeApp() in your main before
you can use any of the Firebase products, for example:
If you want to use the firebase_core plugin in a flutter application,
then in your pubspec.yaml file add the firebase_core as below
dependencies:
flutter:
sdk: flutter
firebase_core : ^1.4.0
Then call the Firebase.initializeApp(), in your main.dart file's
main function:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
no firebase app ' default ' has been created
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
var fsconnect = FirebaseFirestore.instance;
myget() async {
var d = await fsconnect.collection("students").get();
// print(d.docs[0].data());
for (var i in d.docs) {
print(i.data());
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Firebase Firestore App'),
),
body: Column(
children: <Widget>[
RaisedButton(
child: Text('send data'),
onPressed: () {
fsconnect.collection("students").add({
'name': 'sarah',
'title': 'xyz',
'email': '[email protected]',
});
print("send ..");
},
),
RaisedButton(
child: Text('get data'),
onPressed: () {
myget();
print("get data ...");
},
)
],
),
));
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us