withCollapseToNode method

TreeViewController withCollapseToNode(
  1. String key
)

Collapses all nodes down to Node identified by specified key. 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.collapseToNode.

setState((){
  controller = controller.withCollapseToNode(key, newNode);
});

Implementation

TreeViewController withCollapseToNode(String key) {
  List<Node> _data = collapseToNode(key);
  return TreeViewController(
    children: _data,
    selectedKey: this.selectedKey,
  );
}