PerceptionExtension mixin
Marks an LeonardExtension as the sole observation surface for its
namespace. The binding's single observation loop emits a
extensions.<namespace> fragment for every registered extension that mixes
this in (subject to isPerceptionIdle); extensions that do NOT mix it in
contribute no fragment (mirroring the retired observe() => null).
The two non-build members below relocate behaviors the retired
observe() method silently provided:
- isPerceptionIdle reproduces the old
observe() == nullsuppression — when it returnstrue, the binding skips this namespace entirely. - prepareForObservation is the pre-build side-effect seam that used to
live inside
observe()(e.g. riverpod'sflushPendingAt). The binding calls it BEFORE isPerceptionIdle and buildPerception each turn.
- Superclass constraints
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- namespace → String
-
Extension namespace; must match
^[a-z][a-z0-9_]*$.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tools
→ List<
LeonardTool> -
Tools this extension contributes. Returned in stable order.
no setterinherited
Methods
-
buildPerception(
) → Seed - Build the perception tree serialized into this extension's fragment.
-
busyState(
) → Future< BusyState> -
Report whether the extension considers the app busy.
inherited
-
dispose(
) → Future< void> -
Tear down resources. Called once at session end. Exception-isolated
by the registry; every extension's
disposeruns even if earlier extensions throw.inherited -
initialize(
ExtensionContext ctx) → Future< void> -
Called once per session, in registration order. May register error
handlers, VM extensions, and frame callbacks via
ctx.inherited -
isPerceptionIdle(
) → bool -
Whether the extension has nothing to contribute this turn. When
true, the binding emits noextensions.<namespace>fragment — the exact suppression the retiredobserve() => nullprovided. Defaults tofalse(always contribute). Evaluated AFTER prepareForObservation. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onActionExecuted(
ExecutedAction action) → Future< void> -
Notify the extension that an action just executed.
inherited
-
prepareForObservation(
) → void -
Pre-build side-effect hook, called by the binding immediately before
isPerceptionIdle and buildPerception each observation turn. This
relocates side effects that used to run inside
observe()(e.g. draining a pending-change ring). Defaults to a no-op. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited