describeTree method
Returns the mounted tree as indented lines, descending up to maxDepth.
Implementation
List<String> describeTree({int maxDepth = 2}) {
final root = _root;
if (root == null) {
return const <String>[];
}
final lines = <String>[];
void traverse(Element element, int depth) {
lines.add('${' ' * depth}${element.debugDescribeWidget()}');
if (depth >= maxDepth) {
return;
}
for (final child in element.children) {
traverse(child, depth + 1);
}
}
traverse(root, 0);
return lines;
}