nodeById method

FNode? nodeById(
  1. String id
)

Returns the node with the given id in O(1) using a cached index. The index is rebuilt lazily (single tree walk) only when the document has changed since the last lookup.

Implementation

FNode? nodeById(String id) {
  if (_nodeIndexDirty) _rebuildNodeIndex();
  return _nodeById[id];
}