LikePaginatedResponse<T> class

Immutable paginated state snapshot that can be managed by any state management solution (Provider, Riverpod, BLoC/Cubit, GetX, MobX, or LikeChangeNotifier).

Pairs a primary response (LikeStateResponse<List<T>>), a secondary loadMoreResponse for incremental page/cursor loads, and pagination metadata (PaginationTool<T>).

Constructors

LikePaginatedResponse({required LikeStateResponse<List<T>> response, LikeStateResponse<List<T>> loadMoreResponse = const LikeStateResponse<List<Never>>(state: LikeState.idle, message: 'Idle'), PaginationTool<T> pagination = const PaginationTool(), int pageSize = 10})
const
LikePaginatedResponse.idle({int pageSize = 10, String message = 'Idle'})
Creates an initial idle paginated snapshot.
factory
LikePaginatedResponse.loading({int pageSize = 10, String message = 'Loading...'})
Creates an initial loading paginated snapshot.
factory

Properties

currentCursor → String?
Current cursor used for the most recently loaded page, if any.
no setter
currentPage → int
Current resolved 1-based page index.
no setter
error → LikeError?
no setter
hasData → bool
no setter
hashCode → int
The hash code for this object.
no setteroverride
hasMore → bool
Whether there are more pages or cursor items available.
no setter
isCursorMode → bool
Whether this paginated response is operating in cursor-based mode.
no setter
isError → bool
no setter
isException → bool
no setter
isIdle → bool
no setter
isLoading → bool
no setter
isLoadingMore → bool
Whether a load-more operation is currently in progress.
no setter
isRefreshing → bool
no setter
isSuccess → bool
no setter
items → List<T>
Merged list of loaded items across all fetched pages.
no setter
loadMoreError → LikeError?
Error from the most recent load-more request, if any.
no setter
loadMoreResponse → LikeStateResponse<List<T>>
Secondary lifecycle state for load-more (page > 1 or next-cursor) requests.
final
nextCursor → String?
Cursor token to request the next page, if any.
no setter
pageSize → int
Default page size used for pagination calculations.
final
pagination → PaginationTool<T>
Page and cursor metadata along with accumulated items.
final
response → LikeStateResponse<List<T>>
Primary lifecycle state for the paginated list (first page / merged items).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state → LikeState
Current primary lifecycle state.
no setter
totalContent → int?
Total items reported by the API, if any.
no setter
totalPages → int?
Total pages reported by the API, if any.
no setter

Methods

applyCursorPayload({required dynamic payload, bool refresh = false, List<T> itemExtractor(dynamic data)?}) → LikePaginatedResponse<T>
Applies a cursor-based payload (PaginationTool<T>, List<T>, List, or Map with itemExtractor) and returns the updated immutable snapshot.
applyError(LikeError error, {int page = 1}) → LikePaginatedResponse<T>
Transitions either response or loadMoreResponse into an error state, preserving previously loaded items for load-more failures.
applyException(String message, {Object? error, int page = 1}) → LikePaginatedResponse<T>
Transitions either response or loadMoreResponse into an exception state.
applyPayload({required dynamic payload, int page = 1, bool overwrite = false, List<T> itemExtractor(dynamic data)?}) → LikePaginatedResponse<T>
Applies a page-based payload (PaginationTool<T>, List<T>, List, or Map with itemExtractor) and returns the updated immutable snapshot.
copyWith({LikeStateResponse<List<T>>? response, LikeStateResponse<List<T>>? loadMoreResponse, PaginationTool<T>? pagination, int? pageSize}) → LikePaginatedResponse<T>
Returns a copy with overridden fields.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startLoad({int page = 1, bool refresh = false, bool overwrite = false}) → LikePaginatedResponse<T>
Transitions either the primary response (page == 1 and not overwrite) or loadMoreResponse into a loading/refreshing state.
toInitState({String? message}) → LikePaginatedResponse<T>
Resets this paginated snapshot back to idle.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override