getDepartment method
Get a department by id
This function sends a request to the API client to get a department by id. If the request is successful, it returns the department. In case of an error, the error is recorded in Crashlytics and the error is rethrown.
departmentId
The id of the department to get.
Returns a Future<Department> containing the department.
Throws an error if the request fails for any reason.
Implementation
Future<Department> getDepartment(int departmentId) =>
_apiClient.getDepartment(departmentId).catchError((error) {
_crashlytics?.recordError(error, StackTrace.current);
throw error;
});