maybeReadKey<T> method

ZenithNode<T>? maybeReadKey<T>(
  1. ZenithKey<T> key
)

Type-safe optional node lookup that also checks parent containers.

Returns the node for key from this container or the nearest ancestor that has it, or null if no container in the chain has the key.

Implementation

ZenithNode<T>? maybeReadKey<T>(ZenithKey<T> key) {
  final local = _nodes[key];
  if (local != null) {
    return local as ZenithNode<T>;
  }

  return parent?.maybeReadKey<T>(key);
}