


# updatePassword 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)> updatePassword
({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) password})

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



<p>Update or add <code>password</code>.</p>
<p>Throws a UpdatePasswordFailureInterface if
an exception occurs.</p>



## Implementation

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

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







