【发布时间】:2021-11-22 19:48:53
【问题描述】:
我在尝试使用电子邮件和密码创建用户时遇到错误。它给出了一个值为 null 的错误。
body: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextField(
decoration: InputDecoration(labelText: "Email"),
onChanged: (value) {
setState(() {
_email = value;
});
},
),
TextField(
decoration: InputDecoration(labelText: "Password"),
onChanged: (value) {
setState(() {
_password = value;
});
},
obscureText: true,
),
FlatButton(
onPressed: () async {
try {
final newuser = await _auth.createUserWithEmailAndPassword(
_email, _password); // this is the line for the error
if (newuser != Null) {
Navigator.pushNamed(context, '/homepage');
}
} catch (e) {
print(e);
}
},
child: Text("Sign Up"))
],
),
));
如果有人可以帮助我,那将很有帮助
【问题讨论】:
-
可以添加
_auth的代码吗? -
不明白:(
-
auth对象的函数
标签: flutter visual-studio-code