[英]ArgumentError (Invalid argument(s) (onError): The error handler of Future.catchError must return a value of the future's type)
ArgumentError (Invalid argument(s) (onError): The error handler of Future.catchError must return a value of the future's type) ArgumentError(无效参数(onError):Future.catchError 的错误处理程序必须返回未来类型的值)
final User? firebaseUser = (
await fAuth.signInWithEmailAndPassword(
email: emailTextEditingController.text.trim(),
password: passwordTextEditingController.text.trim()
).catchError((msg){
Navigator.pop(context);
Fluttertoast.showToast(msg: "Error" +msg.toString());
})
).user;
Create async method to fetch user.创建异步方法来获取用户。
User? firebaseUser() async {
return await fAuth
.signInWithEmailAndPassword(
email: emailTextEditingController.text.trim(),
password: passwordTextEditingController.text.trim())
.user;
}
you can show toast based on null user.您可以根据 null 用户显示 toast。
checkError() async {
final user = await firebaseUser();
if(user==null){
//show message
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.