findAllChildren method

List<CNode> findAllChildren(
  1. CNode? node
)

Implementation

List<CNode> findAllChildren(CNode? node) {
  if (node == null) return [];

  final nodes = <CNode>[node];

  if (node.child != null) {
    nodes.addAll(findAllChildren(node.child));
  }

  if (node.children != null) {
    for (var child in node.children!) {
      nodes.addAll(findAllChildren(child));
    }
  }

  return nodes;
}