createDepartment method

Future<void> createDepartment(
  1. Department department
)

Create a department

This function sends a request to the API client to create a department. 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 create the department with.

Throws an error if the request fails for any reason.

Implementation

Future<void> createDepartment(Department department) =>
    _apiClient.createDepartment(department.toJson()).catchError((error) {
      _crashlytics?.recordError(error, StackTrace.current);
      throw error;
    });