kache_bloc library
Bloc and Cubit state management integration for Kache.
Classes
-
KacheBlocBinding<
T> - Composes one core resource into an existing Bloc or Cubit.
- KacheCancellationController
- Owns and idempotently cancels a KacheCancellationToken.
- KacheCancellationToken
- A cooperative cancellation token passed to query fetchers.
- KacheClearResult
- Result of a namespace or global cache clear operation.
- KacheClient
- Coordinates typed cache resources, persistence, and shared key state.
-
KacheCubit<
T> - A cache-backed Cubit whose state is the complete KacheSnapshot.
- KacheEvent
- An immutable cache operation event.
- KacheFailure
- A classified failure that retains the original exception and stack trace.
- KacheFetchContext
- Context supplied to every query fetch operation.
- KacheKey
- A stable, typed cache key suitable for memory and persistent storage.
- KacheNamespace
- A validated cache namespace and its canonical storage prefix.
- KacheNetwork
- Supplies network availability without coupling Kache to a platform plugin.
-
KachePersistedEntry<
T> - A typed value and the metadata persisted with it.
- KachePersistedMetadata
- Metadata stored alongside a typed cache value.
- KachePersistenceBackend
- A storage backend that persists typed cache entries.
-
KachePersistenceBinding<
T> -
Opaque, backend-specific configuration for persisting values of type
T. -
KachePersistenceRead<
T> - A successful persistence read and optional lazy maintenance work.
- KachePersistenceState
- Persistence status stored orthogonally to the primary snapshot phase.
- KachePolicy
- Immutable rules for freshness, revalidation, retention, and memory GC.
-
KacheQuery<
T> - An immutable declaration of how to obtain and cache one typed value.
-
KacheResource<
T> - A disposable handle that observes and controls one KacheQuery.
- KacheScheduledTask
- A cancellable delayed callback used for deterministic cache GC.
-
KacheSnapshot<
T> - An immutable, internally consistent view of one cached query.
- MemoryKachePersistence
- An in-process, SDK-only persistence backend for typed cache entries.
Enums
- KacheCancelReason
- Why an in-flight cache operation was cancelled.
- KacheDataSource
- Where the currently visible data originated.
- KacheEventKind
- Stable operation types emitted by KacheClient.events.
- KacheEventPhase
- Lifecycle phase of a KacheEvent.
- KacheEventTrigger
- The command or lifecycle transition that initiated an event trace.
- KacheFailureKind
- Stable categories for failures surfaced by Kache operations.
- KacheFailureScope
- The non-sensitive shape of the operation context for a failure.
- KacheFreshness
- The freshness of a cache value that has not reached hard expiry.
- KacheLayer
- The component involved in an event.
- KacheLookupResult
- Outcome of a cache KacheEventKind.lookup.
- KacheNetworkOwnership
- Determines whether a client closes its network source.
- KacheNetworkState
- Whether a network source currently considers requests worth attempting.
- KachePersistenceOperation
- Operations that can fail while interacting with persistence.
- KachePersistenceOwnership
- Determines whether a client may close its persistence backend.
- KachePersistencePhase
- The current persistence sub-state for a persisted query.
- KachePersistenceStage
- Stages at which a persistence operation can fail.
- KachePhase
- The primary lifecycle phase of a cache snapshot.
- KacheRevalidation
- Whether an automatic lifecycle action should revalidate cached data.
- KacheStorageMode
- Controls where a query stores values during its lifecycle.
Functions
-
systemKacheClock(
) → DateTime - Returns the current wall-clock time normalized to UTC.
-
systemKacheScheduler(
Duration delay, void callback()) → KacheScheduledTask - Schedules cache lifecycle work using a Dart Timer.
Typedefs
-
KacheBlocSnapshotListener<
T> = void Function(KacheSnapshot< T> snapshot) - Receives snapshots from a KacheBlocBinding.
- KacheClock = DateTime Function()
- Supplies the current time to cache operations.
-
KacheFetcher<
T> = Future< T> Function(KacheFetchContext context) - Fetches a typed value for a cache query.
- KacheObserver = void Function(KacheEvent event)
- Receives cache events synchronously after related state is committed.
-
KachePersistenceMaintenance
= FutureOr<
void> Function() - Lazily performs backend-defined persistence maintenance.
- KacheScheduler = KacheScheduledTask Function(Duration delay, void callback())
-
Schedules
callbackafterdelay.
Exceptions / Errors
- KacheCacheMissException
- Cause used by KacheFailureKind.cacheMiss.
- KacheCancelledException
- Signals cooperative cancellation without exposing cache data.
- KacheCommandException
- Aggregates command failures without rendering keys or causes.
- KacheConfigurationException
- Thrown for invalid cache declarations or incompatible query reuse.
- Cause used when an explicit refresh has no configured fetcher.
- KacheKeyFormatException
- Reports a namespace or key-part value that cannot be encoded canonically.
- KacheLifecycleException
- Thrown when an operation targets a disposed resource or closed client.
- KachePersistenceBindingException
- Reports invalid persistence binding configuration without rendering it.
- KachePersistenceException
- A persistence failure with its operation, stage, cause, and stack trace.