handleCrudError method Null safety

void handleCrudError(
  1. DioError dioError,
  2. GeneralCallback<Response> callback
)

Implementation

void handleCrudError(
    DioError dioError, GeneralCallback<Response<dynamic>> callback) {
  if (dioError.isNotPermission) {
    callback.onError(
      GeneralResponse(
        statusCode: notPermission,
        message: ApLocalizations.current.noPermissionHint,
      ),
    );
  } else if (dioError.isNotFoundAnnouncement) {
    callback.onError(
      GeneralResponse(
        statusCode: notPermission,
        message: ApLocalizations.current.notFoundData,
      ),
    );
  } else {
    callback.onFailure(dioError);
  }
}