updateAccountPassword static method

Future<void> updateAccountPassword(
  1. String newPassword,
  2. String oldPassword
)

Implementation

static Future<void> updateAccountPassword(String newPassword, String oldPassword) async {
  if (_currentLoginUser.isLoginedUser == false) {
    // not login !!!
    throw HycopUtils.getHycopException(defaultMessage: 'not login !!!');
  }
  //initialize();
  Map<String, dynamic> newUserData = {};
  newUserData.addAll(_currentLoginUser.getValueMap);
  newUserData['password'] = HycopUtils.stringToSha1(newPassword);
  await HycopFactory.account!.updateAccountPassword(newPassword, oldPassword).catchError(
      (error, stackTrace) => throw HycopUtils.getHycopException(
          error: error, defaultMessage: 'AccountManager.updateAccount Failed !!!'));
  _currentLoginUser = UserModel(userData: newUserData);
}