leafIds<T> static method
All leaf ids beneath (and including, if leaf) node.
Implementation
static List<TreeNodeId> leafIds<T>(TreeNode<T> node) {
final out = <TreeNodeId>[];
void rec(TreeNode<T> n) {
if (n.children.isEmpty) {
out.add(n.id);
} else {
for (final c in n.children) rec(c);
}
}
rec(node);
return out;
}