Paginator<T> class

A generic class that handles pagination logic and API data fetching.

Constructors

Paginator.new({required Future<Map<String, dynamic>> fetchFunction(Map<String, dynamic>), required List<T> parseItems(dynamic), required Meta parseMeta(Map<String, dynamic>), Map<String, dynamic>? initialParameters})

Properties

currentPage int
no setter
fetchFunction Future<Map<String, dynamic>> Function(Map<String, dynamic>)
final
hashCode int
The hash code for this object.
no setterinherited
hasNextPage bool
no setter
isLoading bool
getter/setter pair
itemsNotifier ValueNotifier<List<T>>
final
lastPage int
getter/setter pair
parameters Map<String, dynamic>
Default parameters such as page, limit, filters, etc.
final
parseItems List<T> Function(dynamic)
final
parseMeta Meta Function(Map<String, dynamic>)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showProgress bool
no setter

Methods

fetch({bool reset = false, Map<String, dynamic>? extraParams}) Future<void>
Fetches data from the API with optional reset and extraParams for filtering/searching
loadNextPage() Future<void>
Loads the next page of results
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeParameter(String key) → void
Remove a parameter
toString() String
A string representation of this object.
inherited
updateParameter(String key, dynamic value) → void
Manually update a single parameter

Operators

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