时,它显示错误。当我删除导航器并打印正在打印的内容并在Firebase身份验证中时,我看到了我的电子邮件。 error massage
TextEditingController email = new TextEditingController();
TextEditingController pass = new TextEditingController();
// String email;
// String password;
press: () async {
// print(email);
// print(password);
// try {
// final newUser = await _auth.createUserWithEmailAndPassword(
// email: email.trim(), password: password.trim());
// if (newUser != null) {
// Navigator.pushNamed(context, ChatScreen.id);
// }
// } catch (e) {
// print(e);
// }
AuthResult user;
try {
user = (await mauth.createUserWithEmailAndPassword(
email: email.text.trim(),
password: pass.text.trim(),
));
print("ok");
} catch (e) {
print(e);
} finally {
if (user != null) {
Navigator.pushNamed(context, ChatScreen.id);
//print('sing up ');
}
}
},
答案 0 :(得分:0)
您可以添加默认电子邮件,如果电子邮件为空,则可以添加空白文本
TextField(
controller: email ?? '',
keyboardType: TextInputType.emailAddress,
textAlign: TextAlign.center,
decoration: kTextFieldDecoration.copyWith(
hintText: ' Enter your Email',
),
),