expandAllChildren method

void expandAllChildren(
  1. Tree node, {
  2. bool recursive = false,
})

Utility method for programmatically expanding all the child nodes. By default only the immediate children of the node will be expanded. Set recursive to true expanding all the child nodes until the leaf is reached.

Implementation

void expandAllChildren(Tree node, {bool recursive = false}) {
  expandNode(node);
  for (final child in node.childrenAsList) {
    expandNode(child as Tree);
    if (child.childrenAsList.isNotEmpty)
      expandAllChildren(child, recursive: recursive);
  }
}