withDeleteNode<T> method Null safety

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