Trying to setup the firebase_auth package for Firebase Email/Password Authentication method in Flutter, but need help with email verification.
I came accross the sendEmailVerification(); method provided by firebase_auth package, but need some advice on setting it up. Does anyone have a working code example to follow please?
// 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});
}
Any help, advice, guidance with setting it up properly and working sample code to follow if possible would be much appreciated.
This method will work if you make a FirebaseUser. It can be used like this:
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();
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With