AsyncContext class

The async reactive surface: a distinct graph with its own handles.

Constructors

AsyncContext()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

batch(void run()) → void
Synchronous batch boundary. Cell updates queue invalidation roots; at batch exit, queued roots trigger propagation. Async slots are marked stale (their next getAsync respawns) but do not execute inside the batch callback — async reruns fire after the batch returns.
cell<T>(T value) AsyncCellHandle<T>
Create a mutable input cell (the synchronous input layer).
clear(AsyncSlotHandle slot) → void
Explicitly clear one derived node.
clearSlots(Iterable<AsyncSlotHandle> slots) → void
Clear several derived roots in one frontier walk.
computed<T>(T compute(AsyncComputeContext ctx)) AsyncSlotHandle<T>
Create a synchronous computed on the async graph.
computedAsync<T>(Future<T> compute(AsyncComputeContext ctx)) AsyncSlotHandle<T>
Create an async computed slot.
dependencyCount(AsyncGraphNode node) int
How many nodes node currently depends on — the size of its forward edge set. Returns 0 for a disposed node and for cells, which are pure sources.
dependentCount(AsyncGraphNode node) int
How many nodes currently depend on node — the size of its reverse edge set.
disposeAsync() Future<void>
Dispose the context: cancel all in-flight computations. Awaits completion of all active cleanup futures before returning. Subsequent cell writes are no-ops.
disposeCell(AsyncCellHandle<Object?> cell) Future<void>
Tear down an async source cell. See disposeNode.
disposeEffect(AsyncEffectHandle effect) Future<void>
Tear down an async effect. See disposeNode.
disposeNode(AsyncGraphNode node) Future<void>
Tear down node, dispatching on its own kind.
disposeSlot(AsyncSlotHandle<Object?> slot) Future<void>
Tear down a derived async slot. See disposeNode.
effectAsync(Future body(AsyncComputeContext ctx)) AsyncEffectHandle
Create an async effect with an async cleanup. The body receives a compute context; reruns are serialized per effect (a rerun does not start until the previous cleanup future completes), and disposal awaits the current cleanup before removing the node.
get<T>(AsyncSlotHandle<T> handle) → T
Read a synchronous computed, resolving it inline when dirty.
getCell<T>(AsyncCellHandle<T> handle) → T
Read a cell's value (synchronous).
isEffectActive(AsyncEffectHandle effect) bool
Whether effect is still registered.
isNodeDisposed(AsyncGraphNode node) bool
Whether node has been torn down.
isSet(AsyncSlotHandle handle) bool
Whether a computed currently carries a resolved value.
memoAsync<T>(Future<T> compute(AsyncComputeContext ctx), Equals<T> eq) AsyncSlotHandle<T>
Like computedAsync with an equality memo guard. A recompute that yields an equal value (per eq) suppresses the dependency cascade.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scope() AsyncTeardownScope
Open a teardown scope over this context. See AsyncTeardownScope.
setCell<T>(AsyncCellHandle<T> handle, T value) → void
Update a cell and invalidate dependents (synchronous).
toString() String
A string representation of this object.
inherited
withScope<R>(FutureOr<R> body(AsyncTeardownScope scope)) Future<R>
Run body with a teardown scope that is ended (and awaited) when body completes, even on a throw. The async analogue of the synchronous Context.withScope.

Operators

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