updateEmail method

Future<void> updateEmail(
  1. String newEmail, {
  2. String? locale,
})

Updates the users email address.

This is the email that is used by the user to login with a password. The current email is replaced by newEmail. If the request fails, an AuthException will be thrown.

Firebase sents a notification email to the old email address to notify the user that his email has changed. The user may revoke the change via that email. The language of the email is determined by locale. If not specified, the accounts FirebaseAccount.locale will be used.

Note: If the user has logged in anonymously or via an IDP-Provider, the mail may not be changeable, leading the a failure of this request. You can use getDetails() or FirebaseAuth.fetchProviders to find out which providers a user has activated for this account. You can instead link the account with an email address and a new password via linkEmail().

Implementation

Future<void> updateEmail(
  String newEmail, {
  String? locale,
}) =>
    api.updateEmail(
      EmailUpdateRequest(
        idToken: _idToken,
        email: newEmail,
      ),
      locale ?? this.locale,
    );