尝试在Flutter中为Firebase电子邮件/密码身份验证方法设置firebase_auth包,但需要有关电子邮件验证的帮助。
我遇到了sendEmailVerification(); firebase auth包提供的方法,但需要一些建议。有没有人有一个可行的代码示例?
// From firebase_auth package docs > https://pub.dartlang.org/documentation/firebase_auth/latest/firebase_auth/FirebaseUser/sendEmailVerification.html
Future<void> sendEmailVerification() async {
// TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
// https://github.com/flutter/flutter/issues/26431
// ignore: strong_mode_implicit_dynamic_method
await FirebaseAuth.channel.invokeMethod(
'sendEmailVerification', <String, String>{'app': _app.name});
}
任何帮助,建议,指导与正确设置和如果可能的工作示例代码将非常感激。
如果你制作一个FirebaseUser
,这个方法就可以了。它可以像这样使用:
await _auth.createUserWithEmailAndPassword (
email: //wherever you set their email,
password: //wherever you set their password,
).then((FirebaseUser user) {
//If a user is successfully created with an appropriate email
if (user != null){
user.sendEmailVerification();
}
})
.catchError();