expandAncestors method
Walks up the ancestors of node
setting their expansion state to true
.
Note: node
is not expanded by this method.
This can be used to reveal a hidden node (e.g. when searching for a node in a search view).
parentProvider
should return the direct parent of the given node or
null
if the root node is reached, this callback is used to traverse the
ancestors of node
.
Implementation
void expandAncestors(T node, ParentProvider<T> parentProvider) {
T? current = parentProvider(node);
if (current == null) return;
while (current != null) {
_expand(current);
current = parentProvider(current);
}
rebuild();
}