gpt4 book ai didi

dart - 如何在 flutter 中处理 Firebase Auth 未处理的异常?

转载 作者:IT王子 更新时间:2023-10-29 07:07:08 25 4
gpt4 key购买 nike

<分区>

当我的应用程序的用户在已经注册了 google 的情况下尝试注册 Facebook 时,Flutter 会从控制台给出此错误。我将如何处理我的代码中的这个错误?我假设输出的 exception 部分是错误代码?

Unhandled Exception: PlatformException(exception, An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address., null)
E/flutter ( 5581): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)

这是我的代码:

void loginWithFb() async {
var auth = AuthProvider.of(context).auth;
print('Signing up with fb...');
setState(() {
_showProgressIndicator = true;
});

FirebaseUser user = await auth.signInWithFBAcc();
uId = user?.uid;


if(uId != null) {
print('Signed in: $uId');
widget.onSignedIn(user);
} else {

print('fb login cancelled');

}

// _showAlert(context);
setState(() {
_showProgressIndicator = false;
});
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com