find method

TreeNode? find(
  1. String id
)

Starting from rootNode, searches the subtree looking for a node id that match id, returns null if no node was found with the given id.

Implementation

TreeNode? find(String id) {
  final cachedNode = _searchedNodesCache[id];

  if (cachedNode != null) {
    return cachedNode;
  }

  final searchedNode = rootNode.find(id);

  if (searchedNode != null) {
    _searchedNodesCache[searchedNode.id] = searchedNode;
  }

  return searchedNode;
}