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
-
- Object
- ChangeNotifier
- ValueNotifier<
PagingState< PageKeyType, ItemType> > - PagingController
- Available extensions
Constructors
-
PagingController.new({PagingState<
PageKeyType, ItemType> ? value, required NextPageKeyCallback<PageKeyType, ItemType> getNextPageKey, required FetchPageCallback<PageKeyType, ItemType> fetchPage})
Properties
- error → Object?
-
Available on PagingController<
The last error that occurred while fetching a page.PageKeyType, ItemType> , provided by the PagingControllerExtension extensionno 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<
Will bePageKeyType, ItemType> , provided by the PagingControllerExtension extensiontrue
if there is a next page to be fetched.no setter - isLoading → bool
-
Available on PagingController<
Will bePageKeyType, ItemType> , provided by the PagingControllerExtension extensiontrue
if a page is currently being fetched.no setter -
items
→ List<
ItemType> ? -
Available on PagingController<
The items fetched so far. A flattened version of pages.PageKeyType, ItemType> , provided by the PagingControllerExtension extensionno setter -
keys
→ List<
PageKeyType> ? -
Available on PagingController<
The keys of the pages fetched so far.PageKeyType, ItemType> , provided by the PagingControllerExtension extensionno 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<
The pages fetched so far.PageKeyType, ItemType> , provided by the PagingControllerExtension extensionno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → PagingStatus
-
Available on PagingController<
The paging status.PageKeyType, ItemType> , provided by the PagingControllerExtension extensionno 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).
inherited
-
fetchNextPage(
) → void - Fetches the next page.
-
mapItems(
ItemType mapper(ItemType item)) → void -
Available on PagingController<
Convenience method to update the items of the state.PageKeyType, ItemType> , provided by the PagingControllerExtension extension -
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