作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
FlutterSDK:1.12.13 + hotfix.7
这是我的简单代码:
final PhoneVerificationCompleted phoneVerificationCompleted =
(AuthCredential credential) async{
print("verified $phoneNumber");
try{
await FirebaseAuth.instance.signInWithCredential(credential);
} on PlatformException catch (exception){
print(exception);
} catch (error){
}
[ +876 ms] E/flutter ( 2479): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception:
PlatformException(ERROR_USER_DISABLED, The user account has been disabled by an administrator., null)
[ +4 ms] E/flutter ( 2479): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
[ +29 ms] E/flutter ( 2479): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
[ +2 ms] E/flutter ( 2479):
[ +17 ms] E/flutter ( 2479): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:349:48)
[ +4 ms] E/flutter ( 2479): #3 MethodChannelFirebaseAuth.signInWithCredential
(package:firebase_auth_platform_interface/src/method_channel_firebase_auth.dart:161:23)
[ +19 ms] E/flutter ( 2479): #4 FirebaseAuth.signInWithCredential (package:firebase_auth/src/firebase_auth.dart:208:10)
[ +2 ms] E/flutter ( 2479): #5 _RegisterUiState.verifyNumber.
(package:highest_price/ui/register_ui.dart:47:45)
[ +1 ms] E/flutter ( 2479): #6 MethodChannelFirebaseAuth._callHandler
(package:firebase_auth_platform_interface/src/method_channel_firebase_auth.dart:377:30)
[ +1 ms] E/flutter ( 2479): #7 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:402:55)
[ ] E/flutter ( 2479): #8 MethodChannel.setMethodCallHandler.
(package:flutter/src/services/platform_channel.dart:370:54)
[ +1 ms] E/flutter ( 2479): #9 _DefaultBinaryMessenger.handlePlatformMessage
(package:flutter/src/services/binding.dart:200:33)
[ +3 ms] E/flutter ( 2479): #10 _invoke3. (dart:ui/hooks.dart:303:15)
[ +1 ms] E/flutter ( 2479): #11 _rootRun (dart:async/zone.dart:1126:13)
[ +19 ms] E/flutter ( 2479): #12 _CustomZone.run (dart:async/zone.dart:1023:19)
[ +1 ms] E/flutter ( 2479): #13 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
[ ] E/flutter ( 2479): #14 _invoke3 (dart:ui/hooks.dart:302:10)
[ ] E/flutter ( 2479): #15 _dispatchPlatformMessage (dart:ui/hooks.dart:162:5)
[ ] E/flutter ( 2479):
最佳答案
尝试使用catchError
,它将使您捕获异步代码错误:
final PhoneVerificationCompleted phoneCompleted = (AuthCredential credential) {
FirebaseAuth.instance.signInWithCredential(credential).then((data){
print(data);
}).catchError((error){
print(error);
});
};
关于firebase - firebase_auth:禁用用户时,抛出PlatfromException而不是FirebaseAuthInvalidUserException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60053291/
我是一名优秀的程序员,十分优秀!