PaginationMeta class
Metadata describing the state of a paginated response.
PaginationMeta contains information about the current state of pagination, including page numbers, cursors, and availability of additional pages. This class supports both offset-based and cursor-based pagination strategies.
Offset-based pagination example:
final meta = PaginationMeta(
page: 2,
pageSize: 20,
hasNext: true,
hasPrevious: true,
totalCount: 100,
);
print('Current page: ${meta.page}');
print('Items per page: ${meta.pageSize}');
print('Can load more: ${meta.hasNext}');
Cursor-based pagination example:
final meta = PaginationMeta(
nextCursor: 'eyJpZCI6MTIzfQ==',
previousCursor: 'eyJpZCI6MTAwfQ==',
hasNext: true,
pageSize: 20,
);
// Use nextCursor for the next request
final nextRequest = PaginationRequest(cursor: meta.nextCursor);
- Annotations
Constructors
Properties
- fetchedAt → DateTime
-
Timestamp of when this metadata was produced.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNext → bool
-
Whether there is another page available after this one.
final
- hasPrevious → bool
-
Whether there is another page available before this one.
final
- nextCursor → String?
-
The cursor token returned by the backend to fetch the next page.
final
- page → int?
-
The current page number (1-indexed) when working in offset/page mode.
final
- pageSize → int?
-
The page size that was requested/applied.
final
- previousCursor → String?
-
The cursor token returned by the backend to fetch the previous page.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalCount → int?
-
The total number of items across all pages when provided by the backend.
final
Methods
-
copyWith(
{int? page, int? pageSize, String? nextCursor, String? previousCursor, bool? hasNext, bool? hasPrevious, int? totalCount, DateTime? fetchedAt}) → PaginationMeta -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited