【发布时间】:2018-12-25 11:44:26
【问题描述】:
我在我的 Flutter 应用程序中使用电子邮件注册并使用 Firebase 身份验证。如何在注册页面上显示输入的电子邮件和用户名是否已存在于数据库中?
【问题讨论】:
标签: firebase firebase-authentication flutter
我在我的 Flutter 应用程序中使用电子邮件注册并使用 Firebase 身份验证。如何在注册页面上显示输入的电子邮件和用户名是否已存在于数据库中?
【问题讨论】:
标签: firebase firebase-authentication flutter
firebase 会将该信息作为错误消息返回:
FirebaseAuth.instance.createUserWithEmailAndPassword(email: _email, password: _password).then((user) {
// do whatever you want to do with new user object
}).catchError((e) {
print(e.details); // code, message, details
});
如果电子邮件存在,它将触发catchError。值得注意的是,“详细信息”是人类可读的错误获取器。 'code' 和 'message' 对最终用户毫无用处,但它们是 firebase_auth 上仅有的两个记录。
【讨论】: