isTreeExpanded property

bool get isTreeExpanded

Whether all nodes of this tree are expanded.

Traverses the tree in breadth first order checking the expansion state of each visited node. The traversal will return early if it finds a collapsed node.

Implementation

bool get isTreeExpanded {
  bool allNodesExpanded = false;

  breadthFirstSearch(
    returnCondition: (T node) {
      final bool isExpanded = getExpansionState(node);
      allNodesExpanded = isExpanded;
      // Stop the traversal if [node] is not expanded
      return !isExpanded;
    },
  );

  return allNodesExpanded;
}