PaginationTool<T> class
Generic state, parsing, and calculations for page-based and cursor-based pagination.
Can be used as a standalone pagination container or extended by custom API
response models (e.g. class PaginatedPosts extends PaginationTool<ApiPost>).
Constructors
Properties
- contentLimit → int?
-
final
- currentContent → int?
-
final
- currentPage → int?
-
final
- cursor → String?
-
final
- cursorBased → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasMore → bool
-
Selects a strategy based only on metadata supplied by the API.
no setter
- hasMoreByCursor → bool
-
Uses cursor metadata when provided by the API.
no setter
- hasMoreByList → bool
-
Uses the accumulated list when the API only returns paginated items.
no setter
- hasMoreByPages → bool
-
Uses current and total pages when the API provides page metadata.
no setter
- hasMoreByTotal → bool
-
Uses total item count when the API provides it.
no setter
- hasNext → bool
-
Whether there is a next page available.
no setter
- hasNextOverride → bool?
-
final
- hasPrevious → bool
-
Whether there is a previous page available.
no setter
- hasPreviousOverride → bool?
-
final
- isComplete → bool
-
no setter
- isCursorMode → bool
-
Whether this pagination instance is operating in cursor mode.
no setter
-
items
→ List<
T> ? -
Returns the items/records list.
no setter
- limit → int?
-
Alias for contentLimit.
no setter
-
listData
→ List<
T> ? -
final
- loadedContent → int
-
no setter
- nextCursor → String?
-
final
- nextPage → int
-
no setter
- page → int?
-
final
- progress → double
-
no setter
- remainingContent → int
-
no setter
- remainingPages → int
-
no setter
- resolvedPage → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- total → int?
-
Alias for totalContent.
no setter
- totalContent → int?
-
final
- totalPages → int?
-
final
Methods
-
copyWith(
{int? page, int? contentLimit, int? totalPages, int? totalContent, int? currentPage, int? currentContent, bool? hasNextOverride, bool? hasPreviousOverride, bool? cursorBased, String? cursor, String? nextCursor, List< T> ? listData}) → PaginationTool<T> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overwritePage(
{required int pageNumber, required int limit, required List< T> pageData, int? totalPages, int? totalContent, String? cursor, String? nextCursor, bool? hasNext, bool? hasPrevious}) → PaginationTool<T> -
Overwrites/replaces the slice of items belonging to a specific
pageNumberwith freshpageData, preserving data from other loaded pages. -
reset(
) → PaginationTool< T> -
toJson(
) → Map< String, dynamic> - Alias for toMap.
-
toMap(
) → Map< String, dynamic> - Converts pagination state into a standard Map payload.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateCursor(
{required List< T> pageData, required bool append, String? cursor, String? nextCursor, int? limit, int? totalContent, bool? hasNext, bool? hasPrevious}) → PaginationTool<T> - Returns pagination updated from a cursor-based fetch.
-
updatePage(
{required int page, required int limit, required List< T> pageData, required bool append, int? totalPages, int? totalContent, String? cursor, String? nextCursor, bool? hasNext, bool? hasPrevious}) → PaginationTool<T> - Returns pagination updated with a fetched page.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited