Branch class abstract
Mounted, persistent node in the tree — the Element analogue.
Branch core is artifact-agnostic: it owns identity, lifecycle
(mount/update/unmount), keyed reconciliation, dirtiness, and the single
performRebuild hook. It carries no build contract — the composition layer
(ComponentBranch and friends) defines the hook as re-running build();
other branches define their own rebuild behavior.
Branch deliberately does NOT implement TreeContext. The build-time
capability handle is a separate object
obtained via context; it throws StateError on use after this branch
unmounts, so a handle held across an async gap fails loudly instead of
silently acting on a stale node.
- Mixed-in types
- Implementers
Properties
- branchId ↔ String
-
Stable id for this mounted branch; assigned at mount time via
TreeOwner.issueId and never changes during the branch's lifetime.
latefinal
- context → TreeContext
-
The capability handle for this branch.
no setter
-
dependencies
→ Set<
Branch> -
Providers this branch depends on. Exposed for testing.
Do not use in production code.
no setter
- depth ↔ int
-
Depth from the root (root = 0). Drives the owner's depth-ordered flush.
getter/setter pair
- dirty → bool
-
Whether this branch is currently marked as needing rebuild.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
The Key of the underlying Seed config, or null if unkeyed.
no setter
- mounted → bool
-
Whether this branch is currently mounted in a tree.
no setter
- owner ↔ TreeOwner?
-
The TreeOwner this branch is mounted under. Set by
TreeOwner.mountRoot for roots and inherited from the parent in
mount.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seed → Seed
-
The current Seed configuration for this branch.
no setter
Methods
-
debugDescribeChildren(
) → List< Diagnosticable> -
Returns this object's diagnostic children in display order.
override
-
debugFillProperties(
List< DiagnosticsProperty> properties) → void -
Adds this object's diagnostic properties to
properties.override -
dependencyChanged(
) → void -
Called by
InheritedBranchwhen a depended-on value changes. Default: delegates to markNeedsRebuild.StatefulBranchoverrides this to also flag didChangeDependencies. -
dependOnInheritedSeedOfExactType<
T extends Object> () → T? -
Returns the nearest ancestor value provided via
InheritedSeed<T>of exact typeT, registering this branch as a dependent; null when no such ancestor exists. -
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. -
markNeedsRebuild(
) → void - Marks this branch dirty so the next TreeOwner.flush rebuilds it.
-
mount(
Branch? parent, Object? slot) → void -
Attaches this branch into the tree under
parentatslot. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
performRebuild(
) → void -
The single rebuild hook.
Branchcore attaches no meaning to it; the composition layer defines it as re-runningbuild(), and non-component branches define their own rebuild behavior. -
rebuild(
{bool force = false}) → void -
Runs performRebuild when this branch is mounted and dirty (or when
forceis true — the update path). Clears the dirty flag first, so a branch force-rebuilt during reconciliation is skipped when the owner later drains it in the same flush. -
removeDependency(
Branch dep) → void -
Package-internal: called only by
InheritedBranch.removeDependent. -
toString(
) → String -
A string representation of this object.
inherited
-
toStringDeep(
) → String -
Returns a deterministic multiline description of this object.
inherited
-
unmount(
) → void - Detaches this branch from the tree.
-
update(
Seed newSeed) → void -
Updates the config node when Seed.canUpdate is true, then invokes the
rebuild path: a config update reaches performRebuild with the new
seed already in place. What the hook does is layered — components
re-run
build(); non-component branches respond with their own rebuild semantics. -
updateChild(
Branch? child, Seed? newSeed, Object? slot) → Branch? -
Reconciles
childagainstnewSeedatslot. -
updateChildren(
List< Branch> oldChildren, List<Seed> newSeeds) → List<Branch> -
Reconciles
oldChildrenagainstnewSeedsby key identity. -
visitChildren(
void visitor(Branch dep)) → void -
Calls
visitoronce for each direct child of this branch, in tree order.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited