withExpandToNode method Null safety

TreeViewController withExpandToNode(
  1. String key
)

Expands all nodes down to Node identified by specified key. It returns a new controller with the nodes expanded. This method expects the user to properly place this call so that the state is updated.

Internally uses TreeViewController.expandToNode.

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

Implementation

TreeViewController withExpandToNode(String key) {
  List<Node> _data = expandToNode(key);
  return TreeViewController(
    children: _data,
    selectedKey: this.selectedKey,
  );
}