walk<T> static method
Depth-first walk over every node in sections, with its ancestor path.
Implementation
static void walk<T>(
List<NavSection<T>> sections,
void Function(NavNode<T> node, List<NavNode<T>> ancestors) visit,
) {
void rec(List<NavNode<T>> nodes, List<NavNode<T>> path) {
for (final n in nodes) {
visit(n, path);
if (n.hasChildren) rec(n.children, [...path, n]);
}
}
for (final s in sections) {
rec(s.items, const []);
}
}