expandAll method
Expands all node that are children of the parent node parameter. If no parent is passed, uses the root node as the parent.
Implementation
List<Node> expandAll({Node? parent}) {
List<Node> _children = [];
Iterator iter =
parent == null ? this.children.iterator : parent.children.iterator;
while (iter.moveNext()) {
Node child = iter.current;
if (child.isParent) {
_children.add(child.copyWith(
expanded: true,
children: this.expandAll(parent: child),
));
} else {
_children.add(child);
}
}
return _children;
}