withDeleteNode method

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

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

See TreeViewController.deleteNode for info on optional parameters.

setState((){
  controller = controller.withDeleteNode(key);
});

Implementation

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