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