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