


# updateEmail method




    *[<Null safety>](https://dart.dev/null-safety)*



- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html)

[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)&lt;[Account](../../wyatt_authentication_bloc/Account-class.md)> updateEmail
({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) email})

_<span class="feature">override</span>_



<p>Update or add <code>email</code>.</p>
<p>Throws a UpdateEmailFailureInterface if
an exception occurs.</p>



## Implementation

```dart
@override
Future<Account> updateEmail({required String email}) async {
  try {
    await _firebaseAuth.currentUser!.updateEmail(email);
    final jwt = await _firebaseAuth.currentUser!.getIdToken(true);
    final account = AccountModel.fromFirebaseUser(
      _firebaseAuth.currentUser,
      accessToken: jwt,
    );

    return account;
  } on FirebaseAuthException catch (e) {
    throw UpdateEmailFailureFirebase.fromCode(e.code);
  } catch (_) {
    throw UpdateEmailFailureFirebase();
  }
}
```







