withToggleNode<T> method

TreeViewController withToggleNode<T>(
  1. String key, {
  2. Node? parent,
})

Toggles the expanded property of an existing node identified by specified key. It returns a new controller with the node toggled. This method expects the user to properly place this call so that the state is updated.

See TreeViewController.toggleNode for info on optional parameters.

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

Implementation

TreeViewController withToggleNode<T>(String key, {Node? parent}) {
  List<Node> _data = toggleNode<T>(key, parent: parent);
  return TreeViewController(
    children: _data,
    selectedKey: this.selectedKey,
  );
}