updateUser method

Future<void> updateUser(
  1. User data
)

Update a user

This function sends a request to the API client to update a user. If the request is successful, it returns void. In case of an error, the error is recorded in Crashlytics and the error is rethrown.

data The data to update the user with.

Throws an error if the request fails for any reason.

Implementation

Future<void> updateUser(User data) {
  if (data.id == null) {
    throw ArgumentError('User id cannot be null');
  }

  return _apiClient
      .updateUser(data.id!, data.mapToRequest())
      .catchError((error) {
    _crashlytics?.recordError(error, StackTrace.current);
    throw error;
  });
}