genesis_tree library

Domain-free Seed/Branch tree engine — Flutter's element/reconciliation model extracted to pure Dart.

The spine: Seed (immutable config) mounts as Branch (persistent node), with TreeContext as a separate capability handle — never the Branch itself — and TreeOwner as the scheduler. The composition layer (ComponentBranch, StatelessSeed/StatefulSeed + State, MultiChildSeed, SingleChildSeed + Nest, InheritedSeed/ InheritedModelSeed, Watch) is EXPERIMENTAL and may change before 1.0.

Classes

Branch
Mounted, persistent node in the tree — the Element analogue.
ComponentBranch
A branch that composes by building a single child Seed — the ComponentElement analogue. Defines the rebuild hook as re-running build, so a config update re-runs the builder.
DiagnosticsBuilder
Collects properties supplied by a diagnostic hook.
DiagnosticsDoubleProperty
DiagnosticsDurationProperty
DiagnosticsEnumProperty
DiagnosticsFlagProperty
DiagnosticsIntProperty
DiagnosticsObjectProperty
DiagnosticsProperty
One typed, severity-bearing property on a diagnostics tree node.
DiagnosticsReferenceProperty
DiagnosticsStringProperty
DiagnosticsTimestampProperty
InheritedBranch<T extends Object>
Mounted branch for InheritedSeed. Owns the dependent set, reconciles the single child via the rebuild hook, and invalidates dependents through Branch.dependencyChanged when the value changes.
InheritedModelBranch<T extends Object, A extends Object>
Mounted branch for InheritedModelSeed: InheritedBranch plus per-dependent aspect bookkeeping. notifyDependents consults InheritedModelSeed.updateShouldNotifyDependent with the aspects each dependent asked for and invalidates only those it reports as affected.
InheritedModelSeed<T extends Object, A extends Object>
Provides an ambient value of type T whose dependents may subscribe to a single ASPECT of it — the InheritedModel analogue.
InheritedSeed<T extends Object>
Provides an ambient value of type T to all descendants in the tree — the InheritedWidget analogue.
Key
A first-class identity token for a Seed, used by keyed reconciliation to pair a new configuration with an existing mounted Branch across rebuilds.
MultiChildBranch
Mounted branch for a MultiChildSeed: keyed-reconciles the seed's declared MultiChildSeed.children — the MultiChildRenderObjectElement analogue.
MultiChildSeed
A Seed that carries a fixed, ordered list of child seeds directly in its configuration — the MultiChildRenderObjectWidget analogue, and the multi-child sibling of the single-child component seeds (StatelessSeed/StatefulSeed/Sprout).
Nest
A Seed that stacks a list of SingleChildSeeds into a vertical chain, each wrapping the next down to a single leaf child — the generic Nested/MultiProvider shape, and the vertical sibling of MultiChildSeed's horizontal fan-out.
NestBranch
Mounted branch for a Nest: folds the declared chain into a spine of hook branches and keeps it reconciled.
ObjectKey
A Key backed by the identity of value; equal only when both keys wrap the identical (identical) object.
Seed
Immutable configuration node — the Widget analogue: planted, describes what grows.
SingleChildSeed
Marker interface for a Seed that can slot into a Nest as a link — the single-child analogue of package:nested's SingleChildWidget.
SingleChildState<T extends SingleChildStatefulSeed>
Mutable state for a SingleChildStatefulSeed — a State that describes its subtree through buildWithChild, with the full initState/didChangeDependencies/setState/dispose lifecycle inherited.
SingleChildStatefulBranch
Mounted branch for a SingleChildStatefulSeed: a StatefulBranch — full State lifecycle inherited — that, inside a Nest, builds with the injected downstream instead of the seed's own child.
SingleChildStatefulSeed
A SingleChildSeed whose branch owns mutable SingleChildState — the single-child StatefulSeed, built directly on StatefulSeed.
SingleChildStatelessBranch
Mounted branch for a SingleChildStatelessSeed: a StatelessBranch that, inside a Nest, builds with the injected downstream instead of the seed's own child.
SingleChildStatelessSeed
A SingleChildSeed that composes purely from its own configuration — the single-child StatelessSeed, built directly on StatelessSeed.
Sprout
A Seed whose branch holds its state in hooks declared inline in build — the hooks-style alternative to StatefulSeed + State<T>.
SproutBranch
Mounted branch for a Sprout: a ComponentBranch that owns the persistent hook slots and dispatches hooks by call order.
SproutContext
The build-time hook-dispatch handle passed to Sprout.build.
State<T extends StatefulSeed>
Mutable state owned by a StatefulBranch, with the initState/didChangeDependencies/build/dispose lifecycle.
StateCell<T>
A mutable state cell returned by SproutContext.useState. Setting value marks the owning branch for rebuild (the setState analogue).
StatefulBranch
Mounted branch for a StatefulSeed: creates and owns the State, drives its lifecycle, and delegates build to it.
StatefulSeed
A Seed whose branch owns mutable State — the StatefulWidget analogue.
StatelessBranch
Mounted branch for a StatelessSeed: delegates build to the seed.
StatelessSeed
A Seed that composes purely from its own configuration — the StatelessWidget analogue.
TreeContext
Build-time capability handle into the tree — the BuildContext analogue minus the Element≡BuildContext "original sin".
TreeNode
One semantic node in a TreeSnapshot.
TreeOwner
Owns the root branch, holds the dirty set, and drives synchronous depth-ordered flushes — the BuildOwner.buildScope analogue.
TreeSnapshot
A complete versioned projection of the live diagnostics tree.
ValueKey<T>
A Key backed by a value of type T; equal when both the runtime type and the value are equal.
Watch<T>
Subscribes to source and rebuilds with each event — the Attention primitive: pure composition + dart:async with zero domain semantics.
WatchState<T>
State for Watch: holds the latest value and the stream subscription; each event flows through the setState analogue into a rebuild.

Enums

DiagnosticsLevel
Display severity attached to every diagnostics property.
ReferenceKind
Link target classifier for a DiagnosticsProperty.reference.

Mixins

Diagnosticable
An object that describes its diagnostic properties.
DiagnosticableTree
A Diagnosticable that also describes an ordered child tree.
SingleChildBranchMixin
The branch-side capability that lets a SingleChildSeed's branch receive a downstream injected by an enclosing Nest — the analogue of nested's SingleChildWidgetElementMixin.

Constants

copyWithAbsent → const Object

Functions

checkedEnum<T extends Enum>(List<T> values, String wireValue, String key) → T
checkedJsonDateTime(Map<String, Object?> json, String key) DateTime
checkedJsonList(Map<String, Object?> json, String key) List<Object?>
checkedJsonMap(Map<String, Object?> json, String key) Map<String, Object?>
checkedJsonMapValue(Object? value, String key) Map<String, Object?>
checkedJsonNullableValue<T>(Map<String, Object?> json, String key) → T?
checkedJsonValue<T>(Map<String, Object?> json, String key) → T
listEquals<T>(List<T> left, List<T> right) bool

Typedefs

Dispose = void Function()
A cleanup callback returned by a SproutContext.useEffect effect, run before the effect re-runs and on unmount.
VoidCallback = void Function()
Signature for argument-free callbacks.

Exceptions / Errors

CheckedFromJsonException
A loud failure while decoding the diagnostics wire contract.