PaginationRequest class

Lightweight request descriptor used by the pagination cubit.

PaginationRequest encapsulates all the information needed to fetch a page of data. It supports both offset-based (page/pageSize) and cursor-based pagination strategies.

Offset-based pagination:

final request = PaginationRequest(
  page: 1,
  pageSize: 20,
);

// Next page
final nextRequest = request.copyWith(page: request.page + 1);

Cursor-based pagination:

final request = PaginationRequest(
  pageSize: 20,
  cursor: 'next_page_token',
);

With filters:

final request = PaginationRequest(
  page: 1,
  pageSize: 20,
  filters: {
    'category': 'electronics',
    'minPrice': 100,
    'maxPrice': 500,
  },
);

With extra metadata:

final request = PaginationRequest(
  page: 1,
  pageSize: 20,
  extra: {
    'sortBy': 'price',
    'sortOrder': 'desc',
    'includeDeleted': false,
  },
);
Annotations

Constructors

PaginationRequest({int page = 1, int? pageSize, String? cursor, Map<String, dynamic>? filters, Map<String, dynamic>? extra, String? searchQuery})
const

Properties

cursor String?
Optional cursor/token supplied by the backend.
final
extra Map<String, dynamic>?
Bag for any additional metadata callers want to persist.
final
filters Map<String, dynamic>?
Optional filter payload forwarded to the data provider.
final
hashCode int
The hash code for this object.
no setterinherited
page int
Current page (1-based).
final
pageSize int?
Number of items requested per page.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchQuery String?
Optional search query string for search operations.
final

Methods

copyWith({int? page, int? pageSize, String? cursor, Map<String, dynamic>? filters, Map<String, dynamic>? extra, String? searchQuery}) PaginationRequest
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited