find method

TreeNode? find(
  1. String id
)

Starting from this node, 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) => nullableDescendants.firstWhere(
      (descendant) => descendant == null ? false : descendant.id == id,
      orElse: () => null,
    );