Key class abstract

A first-class identity token for a Seed, used by keyed reconciliation to pair a new configuration with an existing mounted Branch across rebuilds.

A Key is the reconciliation identity: Seed.canUpdate and Branch.updateChildren match by runtimeType + key equality, so a key must define value ==/hashCode (every concrete key here does). Reusing the same key on the same position across a re-emission keeps the branch — and its state — alive instead of tearing it down and rebuilding.

Two concrete kinds ship on the spine:

  • ValueKey — keyed by a value's ==/hashCode (the common case; the unnamed Key factory builds a ValueKey<String>).
  • ObjectKey — keyed by the identity of an object, for when two equal-by- value objects must still be told apart.

Key is intentionally open (abstract, not sealed): the spine ships the two common kinds, and domains/consumers (e.g. the_grid, or the render layer's render-scope key) define their own Key subtypes by extending it and supplying ==/hashCode. The reconciler only ever consults key equality, so any well-behaved subtype slots in.

Deliberately no GlobalKey

Flutter's Key hierarchy has a GlobalKey that enables cross-tree lookup (find any element anywhere by its key, reparent across the tree). genesis refuses that by design: there is no GlobalKey, and no global key registry. Cross-boundary references (e.g. a workflow step that needs another) pass handles down through the parent, keeping the tree one-way and honest — a branch can be reached only by walking from a root, never by a hidden global side-channel. If a genuine global-lookup need ever appears it must be a separate, explicit, opt-in mechanism, never the default Key.

Because there is no GlobalKey, Flutter's intermediate LocalKey layer (whose sole job is to separate local keys from global ones) would be vacuous here, so it is omitted: every Key is local by construction, and the concrete kinds extend Key directly.

Implementers
Annotations
  • @immutable

Constructors

Key(String value)
Constructs a ValueKey that matches on the equality of the given string.
const
factory
Key.empty()
Const constructor for subclasses. The unnamed Key constructor is a factory, so subclasses chain to this instead (: super.empty()).
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited