updateEmail method

Future<void> updateEmail(
  1. String newEmail
)

Updates the user's email address.

An email will be sent to the original email address (if it was set) that allows to revoke the email address change, in order to protect them from account hijacking.

Important: this is a security sensitive operation that requires the user to have recently signed in. If this requirement isn't met, ask the user to authenticate again and then call User.reauthenticateWithCredential.

A FirebaseAuthException maybe thrown with the following error code:

  • invalid-email:
  • Thrown if the email used is invalid.
  • email-already-in-use:
  • Thrown if the email is already used by another user.
  • requires-recent-login:
  • Thrown if the user's last sign-in time does not meet the security threshold. Use User.reauthenticateWithCredential to resolve. This does not apply if the user is anonymous.

Implementation

Future<void> updateEmail(String newEmail) async {
  await _delegate.updateEmail(newEmail);
}