Merhaba, flutter firebase kayıt ol işlemi yaparken ,
Unhandled Exception: [core/no-app] No Firebase App ‘[DEFAULT]’ has been created - call Firebase.initializeApp()
böyle bir hata aldım
void main() async{
WidgetsFlutterBinding.ensureInitialized();
//await Firebase.initializeApp();
runApp(userRegisterPage());
}
class userRegisterPage extends StatelessWidget{
final Future<FirebaseApp> _initialization = Firebase.initializeApp();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: FutureBuilder(
future: _initialization,
builder: (context, snapshot){
if(snapshot.hasError){
return Center(child: Text(“Bağlantını Kontrol Et”),);
}else if(snapshot.hasData){
return user_RegisterClass();
}else{
return Center(child: CircularProgressIndicator(),);
}
},
),
);
}
}
kayıt olma işlemi için uyguladıgım kod
TextEditingController t1 = TextEditingController();
TextEditingController t2 = TextEditingController();
Future<void> userRegister() async{
await FirebaseAuth.instance
.createUserWithEmailAndPassword(email: t1.text, password: t2.text)
.then((value) {
FirebaseFirestore.instance
.collection(“kullanicilar”)
.doc(t1.text)
.set({
“mail”: t1.text,
“password”:t2.text,
});
});
}