updatePassword method

Future<User> updatePassword({
  1. String? userId,
  2. String? username,
  3. String? currentEmail,
  4. required String newPassword,
})

Implementation

Future<dart_blocks.User> updatePassword({
  String? userId,
  String? username,
  String? currentEmail,
  required String newPassword,
}) async {
  dart_blocks.UserRequest req = dart_blocks.UserRequest();
  dart_blocks.User get = dart_blocks.User();
  get.id = userId ?? "";
  get.username = username ?? "";
  get.email = currentEmail ?? "";
  dart_blocks.User update = dart_blocks.User();
  update.password = newPassword;
  req.cloudToken = await _authorize.getAccessToken();
  req.encryptionKey = _encryptionKey ?? "";
  req.user = get;
  req.update = update;
  try {
    dart_blocks.UserResponse resp = await _grpcUserClient.updatePassword(req);
    return resp.user;
  } catch (e) {
    if (debug == true)
      print("could not create user with err: " + e.toString());
    rethrow;
  }
}