SproutContext class abstract
The build-time hook-dispatch handle passed to Sprout.build.
Extends TreeContext (throw-after-unmount inherited) with the hook surface. Hooks may only be called inside Sprout.build, unconditionally and in a stable order. A changed hook count or a type change at a position throws; a call outside build asserts; a same-shape reorder is undetectable (the positional-hooks caveat) — keep the order stable.
- Implemented types
Constructors
Properties
- branchId → String
-
Stable id of the bound branch, issued by
TreeOwner.issueIdat mount.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
The Key of the bound branch's
Seedconfig, or null if unkeyed.no setterinherited - mounted → bool
-
Whether the bound branch is still mounted. Never throws — this is the
safe staleness probe for handles held across async gaps.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dependOnInheritedSeedOfExactType<
T extends Object> ({Object? aspect}) → T? -
Returns the nearest ancestor value provided via
InheritedSeed<T>of exact typeT, registering the bound branch as a dependent; null when no such ancestor exists.inherited -
getInheritedSeedOfExactType<
T extends Object> () → T? -
Returns the nearest ancestor value provided via
InheritedSeed<T>of exact typeTwithout registering a dependency; null when no such ancestor exists.inherited -
markNeedsRebuild(
) → void -
Marks the bound branch dirty for the next
TreeOwner.flush.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
useEffect(
Dispose? effect(), [List< Object?> ? keys]) → void -
Runs
effectas a microtask-deferred passive effect. Withkeysomitted it runs after every build;const []runs once (mount); a non-empty list re-runs when the keys change element-wise.effectmay return a Dispose cleanup, run before the next re-run and on unmount. -
useMemo<
T> (T create(), List< Object?> keys) → T -
Returns a value computed by
create, recomputed only whenkeyschange. Stabilizes derived identities (e.g. a stream) across rebuilds. -
useState<
T> (T initial) → StateCell< T> -
Declares a persistent state StateCell seeded with
initialon first build; later builds return the same cell (the newinitialis ignored). -
useStream<
T> (Stream< T> source, {required T initial}) → T -
Subscribes to
sourceand returns its latest value (orinitialbefore the first event). Re-subscribes only when the source changes (by==, keeping the last value); cancels on unmount. CollapsesWatch.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited