getNamePath static method
Returns the name lookup path from the ancestor node to the child node.
Implementation
static Iterable<String>? getNamePath(Node ancestor, Node child) {
List<String> result = [];
Node? current = child;
while (current != null) {
if (identical(current, ancestor)) {
return result.reversed;
}
result.add(current.name);
current = current._parent;
}
debugPrint(
'Name path formation failed because the given ancestor was not an ancestor of the given child.');
return null;
}