applyException method

LikePaginatedResponse<T> applyException(
  1. String message, {
  2. Object? error,
  3. int page = 1,
})

Transitions either response or loadMoreResponse into an exception state.

Implementation

LikePaginatedResponse<T> applyException(
  String message, {
  Object? error,
  int page = 1,
}) {
  final exceptionResponse = LikeStateResponse<List<T>>.exception(
    message,
    error: error,
  );
  if (page == 1) {
    return copyWith(response: exceptionResponse);
  }
  return copyWith(loadMoreResponse: exceptionResponse);
}