withToggleNode method
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(String key, {Node<T>? parent}) {
List<Node<T>> _data = toggleNode(key, parent: parent);
return TreeViewController(
children: _data,
selectedKey: this.selectedKey,
);
}