KacheNotifier<T> class final

A Riverpod notifier backed by exactly one core KacheResource.

Use the top-level kacheProvider builder to construct providers. The notifier exposes the full KacheSnapshot so cached data, refresh progress, and failures can coexist.

Override a Kache provider with Riverpod's overrideWith and construct a replacement notifier. overrideWithBuild is incompatible because it skips the resource binding performed by build.

Constructors

KacheNotifier({required KacheClientBuilder client, required KacheQueryBuilder<T> query, bool keepAlive = false})
Creates a notifier for the supplied client and query builders.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isKeptAlive → bool
Whether this notifier currently holds a Riverpod keep-alive link.
no setter
query → KacheQuery<T>
The query bound by the current provider build.
no setter
ref → Ref
The Ref associated with this notifier.
no setterinherited
resource → KacheResource<T>
The resource bound by the current provider build.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state ↔ KacheSnapshot<T>
The value currently exposed by this notifier.
getter/setter pairinherited
stateOrNull → KacheSnapshot<T>?
The value currently exposed by this Notifier.
no setterinherited

Methods

build() → KacheSnapshot<T>
Initialize a Notifier.
cancel() → bool
Cancels the shared in-flight fetch for the current key.
invalidate({bool refetch = true}) → Future<KacheSnapshot<T>>
Marks current data stale and optionally starts a fetch.
keepAlive() → void
Keeps an auto-dispose provider alive after its final listener is removed.
listenSelf(void listener(KacheSnapshot<T>? previous, KacheSnapshot<T> next), {void onError(Object error, StackTrace stackTrace)?}) → RemoveListener
Listens to changes on the value exposed by this provider.
inherited
load() → Future<KacheSnapshot<T>>
Loads persistence and applies the query's load policy.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() → Future<KacheSnapshot<T>>
Forces a fetch while preserving cached data according to policy.
releaseKeepAlive() → void
Releases the current keep-alive link, if any.
remove() → Future<KacheSnapshot<T>>
Removes current memory and persisted data without fetching.
runBuild() → WhenComplete?
Executes Notifier.build.
inherited
setData(T data) → Future<KacheSnapshot<T>>
Replaces the current value immediately.
toString() → String
A string representation of this object.
inherited
updateData(T update(KacheSnapshot<T> snapshot)) → Future<KacheSnapshot<T>>
Atomically updates data from the latest shared snapshot.
updateShouldNotify(KacheSnapshot<T> previous, KacheSnapshot<T> next) → bool
A method invoked when the state exposed by this Notifier changes. It compares the previous and new value, and return whether listeners should be notified.
inherited

Operators

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