【发布时间】:2022-12-31 08:28:09
【问题描述】:
如果用户尝试使用现有的电子邮件注册,我无法处理错误
Future _createUser(Users user, String name, x) async {
UserCredential result = await FirebaseAuth.instance
.createUserWithEmailAndPassword(
email: _emailController.text.trim(),
password: _passwordController.text.trim());
try {
result;
} on FirebaseAuthException catch (e) {
if (e.code == 'firebase_auth/email-already-in-use') {
final snackBarx = SnackBar(
elevation: 0,
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.transparent,
content: AwesomeSnackbarContent(
message: 'Error please log in again and try again',
contentType: ContentType.failure,
),
);
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(snackBarx);
【问题讨论】:
标签: flutter firebase firebase-authentication