ObserverEngine class final
The all_observer preset of the public ReactiveEngine (engine v2,
Fase 2): the concrete engine instance plus the node types that bridge
the engine graph to the package's registry-based world.
Three node kinds participate:
- RegistrySignalNode — the engine identity of a
ListenerRegistry(a plainCoreObservable, a reactive collection, anything that notifies through a registry). Created lazily on first tracked read. - ComputedEngineNode — the engine identity of a
CoreComputed. Itsupdate/unwatchedbehavior is delegated back to the owningCoreComputedthrough callbacks, soequalsfiltering and inspector events stay where they always lived. - WatcherNode — an effect-like node owned by a
CoreComputedthat has external listeners; it is what turns lazy engine marking into the package's eager listener notification, by scheduling a pull throughBatchScope.queueDirtyFlush(wired via callback to avoid an import cycle).
O preset all_observer do ReactiveEngine público (motor v2, Fase 2):
a instância concreta do motor mais os tipos de nó que fazem a ponte
entre o grafo do motor e o mundo baseado em registries do pacote.
Três tipos de nó participam:
- RegistrySignalNode — a identidade no motor de um
ListenerRegistry(umCoreObservablecomum, uma coleção reativa, qualquer coisa que notifique por um registry). Criado preguiçosamente na primeira leitura rastreada. - ComputedEngineNode — a identidade no motor de um
CoreComputed. Seu comportamento deupdate/unwatchedé delegado de volta aoCoreComputeddono através de callbacks, então o filtroequalse os eventos de inspector continuam onde sempre viveram. - WatcherNode — um nó tipo effect, de posse de um
CoreComputedcom listeners externos; é o que converte a marcação preguiçosa do motor na notificação ansiosa de listeners do pacote, agendando um pull viaBatchScope.queueDirtyFlush(ligado por callback para evitar ciclo de import).
- Inheritance
-
- Object
- ReactiveEngine
- ObserverEngine
Properties
- activeSub ↔ ReactiveNode?
-
The node currently (re)computing, if any — reads reaching
DependencyTracker.reportReadwhile this is non-null are linked as engine dependencies of it.getter/setter pair - cycle ↔ int
-
Monotonic tracking-cycle counter (see ReactiveEngine.link).
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
checkDirty(
ReactiveLink link, ReactiveNode sub) → bool -
Pull phase: walks
sub's dependencies starting atlinkand confirms whether anything upstream actually changed, calling update on stale mutable dependencies along the way (deepest first, iteratively). Returnstrueifsubmust recompute. This is what makespendingcheap: a maybe-stale node only does real work when someone pulls it.inherited -
isValidLink(
ReactiveLink checkLink, ReactiveNode sub) → bool -
Whether
checkLinkis currently an edge ofsub's dependency list. Used by propagate to validate self-dependency scenarios.inherited -
link(
ReactiveNode dep, ReactiveNode sub, int version) → void -
Records that
subdepends ondepin tracking cycleversion.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
ReactiveNode node) → void -
Called during propagate for nodes flagged ReactiveFlags.watching.
Implementations typically queue the node for execution after the
current write/batch completes.
override
-
propagate(
ReactiveLink link, [bool innerWrite = false]) → void -
Push phase: starting from
link(the subscriber list of a node that just changed), walks the graph iteratively marking subscriberspending(ordirtyvia shallowPropagate later) and calling notify on watching nodes. Recursion through mutable nodes is flattened with an explicit EngineStack.innerWritemust betruewhen the write happened inside a running effect, enabling the re-entrancy bookkeeping (ReactiveFlags.recursed).inherited -
shallowPropagate(
ReactiveLink link) → void -
Promotes
pendingsubscribers of a node that confirmed a change todirty, notifying watchers. Non-recursive: touches immediate subscribers only.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
unlink(
ReactiveLink link, ReactiveNode sub) → ReactiveLink? -
Removes the edge
linkfrom both lists it belongs to. If the dependency side loses its last subscriber, unwatched fires. Returns the next link insub's dependency list (an iteration convenience).inherited -
unwatched(
ReactiveNode node) → void -
Called by unlink when
nodeloses its last subscriber — the hook for automatic cleanup (release dependencies, stop work, free caches).override -
update(
ReactiveNode node) → bool -
Recomputes
node's value in place and returns whether it actually changed. Returningfalsecuts propagation belownode(this is where anequalspolicy plugs in).override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → ObserverEngine
-
The single engine instance behind the whole package.
final