Pagination<T extends Object> class
Manages pagination state and data retrieval.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
PaginationState< T> > - Pagination
Constructors
Properties
- config → PaginationConfig
-
no setter
- error ↔ dynamic
-
The current error, if any. Initially
null
.getter/setter pair - fetchingSize → int
-
Number of items to fetch each time.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- initialSize → int
-
Retrieves the size of the initial loading batch.
no setter
- isControllerMode → bool
-
no setter
- isFinish → bool
-
Indicates whether all available data has been loaded.
no setter
- isInitial → bool
-
Indicates whether the pagination is in its initial state.
no setter
- isLoading → bool
-
Indicates whether data is currently being loaded.
no setter
- itemCount → int
-
Retrieves the total number of items to display.
no setter
-
items
→ List<
T> -
Retrieves the list of items currently loaded.
no setter
- limit → int?
-
Retrieves the maximum number of items to load.
no setter
- loadingSize → int
-
Retrieves the total number of items to load.
no setter
- preload → double
-
Distance to preload more data.
final
- remainingSize → int
-
Calculates the remaining number of items that can be loaded.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Retrieves the total number of items loaded.
no setter
- snapshot ↔ Object?
-
The key for the next page to be fetched.
getter/setter pair
- snapshotAsPage → int
-
Retrieves the current snapshot interpreted as a page number.
no setter
- threshold → int?
-
Distance to preload more data.
final
- triggerIndex → int
-
no setter
-
value
↔ PaginationState<
T> -
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
callback(
{required OnPaginationCallback< T> callback, OnPaginationNotifier<T> ? notifier}) → void -
clear(
) → List< T> - Clear all items
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
fetch(
) → void - Fetches more data based on the current pagination state.
-
getItem(
int index) → PaginationData< T> - Retrieves the item at the specified index.
-
getRealIndex(
int index) → int - Retrieves the item real index at the specified index.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
paginate(
{required ScrollController controller, required OnPaginationCallback< T> callback, required OnPaginationNotifier<T> notifier}) → void - Initializes pagination for the associated ScrollController.
-
push(
PaginationResponse< T> value) → void -
reload(
[bool reload = true]) → void - Initializes pagination state and data retrieval.
-
removeItem(
int index) → T - Remove the item at the specified index.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
retry(
) → void - Erases the current error.
-
set(
List< T> value, [bool notify = true]) → void - Clear all items
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
int index, T callback(T old)) → void - Update the item at the specified index.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
apply<
T extends Object> (String name, {required ScrollController controller, required OnPaginationCallback< T> callback, required OnPaginationNotifier<T> notifier}) → void - Applies pagination to a ScrollController with the specified callbacks.
-
attach<
T extends Object> (String name, {required OnPaginationCallback< T> request, OnPaginationNotifier<T> ? response}) → void -
clearOf<
T extends Object> (String name) → List< T> - Clear all items.
-
closeOf(
String name) → void -
configOf<
T extends Object> (String name) → PaginationConfig -
disposeOf<
T extends Object> (String name) → void -
init<
T extends Object> (String name, {int fetchingSize = 10, int? limit, int? threshold, double preload = 1000, int? initialSize, Object? snapshot}) → Pagination< T> - Initializes a new Pagination instance with the provided settings.
-
itemCountOf<
T extends Object> (String name) → int - Retrieves the total item count from the Pagination instance.
-
itemOf<
T extends Object> (String name, int index) → PaginationData< T> - Retrieves the item at the specified index.
-
itemsOf<
T extends Object> (String name) → List< T> - Retrieves all items from the Pagination instance.
-
notify<
T extends Object> (String name) → void -
of<
T extends Object> (String name) → Pagination< T> - Retrieves a Pagination instance by name.
-
pushOf<
T extends Object> (String name, PaginationResponse< T> value) → void -
realIndexOf<
T extends Object> (String name, int index) → int - Retrieves the item real index at the specified index.
-
reloadOf<
T extends Object> (String name, [bool reload = true]) → void -
removeItemOf<
T extends Object> (String name, int index) → T - Remove the item at the specified index.
-
setOf<
T extends Object> (String name, List< T> value, {bool notify = true}) → void -
updateItemOf<
T extends Object> (String name, int index, T callback(T old)) → void - Update the item at the specified index.