EnhancedPaginationController class

Tracks pagination state for an EnhancedPaginatedView.

It owns two pieces of state:

  • page: the page number that should be passed to the next onLoadMore call.
  • isLoadingMore: whether a load-more request is currently in flight.

Consumers may create and own an instance themselves (to read page or isLoadingMore elsewhere in their UI) and pass it to EnhancedPaginatedView via its controller parameter. If none is provided, the widget creates and manages one internally.

Page advancement is driven by the delegate's status transitions: the page is only incremented when the consumer's status goes from loading to loaded. This means the consumer must emit a loading status before each loaded status for a given page load (including the very first page) for page to advance correctly. If a consumer instead preloads the first page (i.e. starts with non-empty data and status loaded, with no preceding loading), construct this controller with EnhancedPaginationController(initialPage: 2) so the next requested page is correct.

Inheritance

Constructors

EnhancedPaginationController({int initialPage = 1})
Creates a new EnhancedPaginationController.

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isLoadingMore → bool
Whether a load-more request is currently in flight.
no setter
page → int
The page number to pass to the next onLoadMore call.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
inherited
markDataReceived() → void
Marks that data for the current page was received successfully.
markLoadFailed() → void
Marks that the current page failed to load.
markLoadStarted() → void
Marks that a load-more request has started.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
Resets pagination back to the first page.
toString() → String
A string representation of this object.
inherited

Operators

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