【发布时间】:2022-10-14 02:17:47
【问题描述】:
我正在使用 firebase_auth 的 signInWithEmailAndPassword 方法经历一个奇怪的行为
如果抛出错误,try catch 块应该捕获但 PLatformException 在编辑器中向上流动,就像我调用正常的 async/await 方法而没有捕获错误一样:
奇怪的是我已经在以前的项目中使用了相同的代码并且它工作正常,我做了相同的配置,并且它在正确的身份验证数据下工作正常,只是如果有错误它不会捕获它 我的代码:
Future handleLoginProcess(BuildContext context) async {
_handleInputsCases();
_startLoading();
try {
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: "barry.allen@example.com", password: "SuperSecretPassword!");
} on FirebaseAuthException catch (e) {
print('Failed with error code: ${e.code}');
print(e.message);
}
_endLoading();
}
抛出的错误似乎引导我这样做:
if (errorCode is String && (errorMessage == null || errorMessage is String) && !buffer.hasRemaining) {
throw PlatformException(code: errorCode, message: errorMessage as String?, details: errorDetails, stacktrace: errorStacktrace);
} else {
throw const FormatException('Invalid envelope');
}
我遗漏了一些东西,这可能是什么原因,它与vscode有关吗?
请与我分享您的想法,谢谢
【问题讨论】:
-
什么是错误日志
标签: flutter firebase dart firebase-authentication