PagingController<PageKeyType, ItemType> class

A controller to handle a PagingState.

This is an unopinionated controller implemented through vanilla Flutter's ValueNotifier. The controller acts as a mutex to prevent multiple fetches at the same time.

Note that for convenience, fetch operations are not atomic. The state may be updated during a fetch operation. This should be done fully synchronously, as otherwise, the state may become desynchronized.

Inheritance
Available extensions

Constructors

PagingController({PagingState<PageKeyType, ItemType>? value, required NextPageKeyCallback<PageKeyType, ItemType> getNextPageKey, required FetchPageCallback<PageKeyType, ItemType> fetchPage})

Properties

error → Object?

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

The last error that occurred while fetching a page.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
hasNextPage → bool

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

Will be true if there is a next page to be fetched.
no setter
isLoading → bool

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

Will be true if a page is currently being fetched.
no setter
items → List<ItemType>?

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

The items fetched so far. A flattened version of pages.
no setter
keys → List<PageKeyType>?

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

The keys of the pages fetched so far.
no setter
operation ↔ Object?
Keeps track of the current operation. If the operation changes during its execution, the operation is cancelled.
getter/setter pair
pages → List<List<ItemType>>?

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

The pages fetched so far.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → PagingStatus

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

The paging status.
no setter
value ↔ PagingState<PageKeyType, ItemType>
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
cancel() → void
Cancels the current fetch operation.
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).
override
fetchNextPage() → void
Fetches the next page.
mapItems(ItemType mapper(ItemType item)) → void

Available on PagingController<PageKeyType, ItemType>, provided by the PagingControllerExtension extension

Convenience method to update the items of the state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
refresh() → void
Restarts the pagination process.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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