collectGroupPaths<T> function

List<String> collectGroupPaths<T>(
  1. List<GroupNode<T>> nodes
)

Every group path in a tree.

GroupExpansionState.collapseAll no longer needs it - closing "every group" cannot be a list of the groups currently on screen - but a caller that wants to act on the paths it can see still can.

Implementation

List<String> collectGroupPaths<T>(List<GroupNode<T>> nodes) {
  final out = <String>[];
  void walk(List<GroupNode<T>> level) {
    for (final node in level) {
      out.add(node.path);
      walk(node.children);
    }
  }

  walk(nodes);
  return out;
}