visitDepth method
Implementation
@override
void visitDepth(VisitCallback visit, {Node? startNode}) {
final origin = startNode ?? subtreeRoot;
if (!_subtreeNodes.contains(origin)) {
throw StateError('Node "${origin.key}" is not in the subtree');
}
final stack = <Node>[origin];
while (stack.isNotEmpty) {
final node = stack.removeLast();
if (visit(node) == VisitResult.breakVisit) return;
final children = getNodeEdges(node).toList();
for (var i = children.length - 1; i >= 0; i--) {
stack.add(children[i]);
}
}
}