PaginationController<T> class

Manages the state and lifecycle of a paginated request.

This controller handles the data, loading, error, and pagination states, as well as provides methods to change pages and refresh the data.

Constructors

PaginationController.new(Future<PaginationResult<T>> service(int page, int pageSize), PaginationOptions<T> options)

Properties

data Ref<List<T>>
The fetched data for the current page. It is a Ref.
final
error Ref<Object?>
The error object if the request fails. It is a Ref.
final
hashCode int
The hash code for this object.
no setterinherited
loading Ref<bool>
The loading state of the request. It is a Ref.
final
options PaginationOptions<T>
The options for the pagination request.
final
page Ref<int>
The current page number. It is a Ref.
final
pageSize Ref<int>
The number of items per page. It is a Ref.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
service Future<PaginationResult<T>> Function(int page, int pageSize)
The asynchronous function that fetches the data for a given page and page size.
final
total Ref<int>
The total number of items across all pages. It is a Ref.
final

Methods

changePage(int newPage) → void
Changes the current page and re-runs the request.
changePageSize(int newSize) → void
Changes the page size, resets the page to 1, and re-runs the request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() → void
Re-runs the request for the current page. Alias for run.
run() Future<void>
Executes the request for the current page and page size.
toString() String
A string representation of this object.
inherited

Operators

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