withCollapseAll method Null safety

TreeViewController withCollapseAll(
  1. {Node? parent}
)

Collapses all nodes down to parent Node. It returns a new controller with the nodes collapsed. This method expects the user to properly place this call so that the state is updated.

Internally uses TreeViewController.collapseAll.

setState((){
  controller = controller.withCollapseAll();
});

Implementation

TreeViewController withCollapseAll({Node? parent}) {
  List<Node> _data = collapseAll(parent: parent);
  return TreeViewController(
    children: _data,
    selectedKey: this.selectedKey,
  );
}