PagedNotifier<T> class
abstract
State notifier for managing a PagedValue.
Contains various methods for loading more pages and reloading the entire list of values.
Subclasses should implement incrementPageOffset, resetPageOffset, and getPagedValue to handle the business logic for actually obtaining paged values.
Users of the notifier can then call loadPage or reload to load update the current paged value with additional pages, or reset the value to load fresh from the start, respectively.
Optionally, other methods for combining pages or determining whether the end of the list has been reached can be overriden by subclasses who need domain-specific customizations.
- Inheritance
-
- Object
- StateNotifier<
PagedValue< T> > - PagedNotifier
- Implementers
Constructors
-
PagedNotifier([List<
T> ? initialValue])
Properties
-
debugState
→ PagedValue<
T> -
A development-only way to access state outside of StateNotifier.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
If a listener has been added using addListener and hasn't been removed yet.
no setterinherited
- mounted → bool
-
Whether dispose was called or not.
no setterinherited
- onError ↔ ErrorListener?
-
A callback for error reporting if one of the listeners added with addListener throws.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
↔ PagedValue<
T> -
The current "state" of this StateNotifier.
getter/setter pairinherited
-
stream
→ Stream<
PagedValue< T> > -
A broadcast stream representation of a StateNotifier.
no setterinherited
Methods
-
addListener(
Listener< PagedValue< listener, {bool fireImmediately = true}) → RemoveListenerT> > -
Subscribes to this object.
inherited
-
combineList(
List< T> ? existing, List<T> pageValue) → List<T> - Combine the existing list (if available) with a new paged value.
-
dispose(
) → void -
Frees all the resources associated with this object.
override
-
getPagedValue(
) → Future< List< T> > -
Subclasses must return a single page containing a list of
Tvalues. -
hasReachedEnd(
List< T> list) → bool - Should return whether the end of the list has been reached.
-
incrementPageOffset(
PagedValue< T> value) → void - Subclasses must use this method to increment their internal representation of the page offset.
-
loadPage(
) → Future< bool> - Load a new page, which will then be appended to the existing paged value.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reload(
) → Future< void> - Reload the paged value list from the start, resetting the offset in the process.
-
resetPageOffset(
) → void - Subclasses must reset their internal representation of the page offset.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateShouldNotify(
PagedValue< T> old, PagedValue<T> current) → bool -
Whether to notify listeners or not when state changes
inherited
-
updateValue(
{bool isInitialLoad = false, bool isReload = false}) → Future< void> - Update the paged value by loading a new page and combining it with the existing paged value.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited