Traverses all the nodes attached to the tree depth first. Calling back action on each node hit.
action
void traverse(void Function(TreeNode) action) { for (final node in rootNodes) { node.traverse(action); } }