[英]Undefined name 'AuthException'. Firebase
I am getting error like我收到类似的错误
Undefined name 'AuthException'
未定义的名称“AuthException”
When I am trying to use it as following in my Flutter app.当我尝试在我的 Flutter 应用程序中使用它时。
Future<bool> login({phoneNr, BuildContext context}) async {
_auth.verifyPhoneNumber(
phoneNumber: phoneNr,
timeout: Duration(seconds: 60),
verificationCompleted: (AuthCredential credential) async {
UserCredential result = await _auth.signInWithCredential(credential);
User user = result.user;
if (user != null) {
Navigator.pushNamed(context, HomeScreen.id, arguments: user);
}
},
verificationFailed: (AuthException exception) // THIS LINE HERE
);
}
I know, they might have changed the name just like they did for "FirebaseUser" to just "User";我知道,他们可能已经将名称更改为“FirebaseUser”,就像他们将“FirebaseUser”更改为“User”一样; but their formal documentation still shows "AuthException" as a valid class. However despite importing and upgrading all expected packages, I am still getting the same error.
但是他们的正式文档仍然将“AuthException”显示为有效的 class。但是,尽管导入并升级了所有预期的包,但我仍然遇到相同的错误。 Any solution?
任何解决方案?
Use FirebaseAuthException instead of AuthException if you are using Flutter 2.如果您使用 Flutter 2,请使用 FirebaseAuthException 而不是 AuthException。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.