toggleNode<T> method
Toggles an existing node identified by specified key. This method returns a new list with the specified node toggled.
Implementation
List<Node> toggleNode<T>(String key, {Node? parent}) {
Node<T>? _node = getNode<T>(key, parent: parent);
return updateNode<T>(key, _node!.copyWith(expanded: !_node.expanded));
}