CollectionLifecycleController<T, K, F> class
final
Full collection lifecycle controller: debounce, cancellation, stale-response protection, refresh and progressive loading.
- Inheritance
-
- Object
- ChangeNotifier
- CollectionLifecycleController
Constructors
-
CollectionLifecycleController({required CollectionLifecycleLoader<
T, F> load, required CollectionQuery<F> query, required K keyOf(T item), CollectionLoadMore<T, F> ? loadMore, CollectionSnapshot<T> ? initialSnapshot, Duration searchDebounce = const Duration(milliseconds: 350)}) - Creates a lifecycle owner without starting a request.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
query
→ CollectionQuery<
F> -
Most recently committed query. A search still waiting for debounce is
not included yet.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchDebounce → Duration
-
Delay before a changed trimmed search string is committed to query and
loaded.
final
-
snapshot
→ CollectionSnapshot<
T> -
Latest immutable presentation snapshot; listen to this controller for
load and event updates.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
apply(
CollectionEvent< T, K> event) → void - Applies a presentation event using the configured stable-key extractor and notifies listeners. This does not persist data or execute a loader, including for CollectionRefreshRequested.
-
dispose(
) → void -
Cancels pending search debounce and outstanding requests, disposes
cancellation signals, and releases listeners. Do not use the controller
after disposal.
override
-
initialize(
) → Future< void> - Runs the loader with an initial-request reason. This is explicit, not automatic, and is not restricted to a single call.
-
loadMore(
) → Future< void> - Calls the optional batch loader with the current snapshot and replaces the snapshot with its result.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
refresh(
) → Future< void> - Runs the current query with a refresh reason while retaining usable items. Starting it cancels the preceding active request; late results are ignored.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setPage(
CollectionPageRequest page) → Future< void> - Replaces only the paging request and loads the resulting query.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateQuery(
CollectionQuery< F> query, {bool load = true}) → Future<void> -
Stores
queryand, by default, awaits a query load. -
updateSearch(
String value) → void - Debounces a trimmed search value before issuing a query load.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited