withUpdateNode<T> method

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

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

See TreeViewController.updateNode for info on optional parameters.

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

Implementation

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