removeNode<T> static method
Rebuild nodes with id (and its subtree) removed.
Implementation
static List<TreeNode<T>> removeNode<T>(List<TreeNode<T>> nodes, TreeNodeId id) {
final out = <TreeNode<T>>[];
for (final n in nodes) {
if (n.id == id) continue;
out.add(n.children.isEmpty ? n : n.copyWith(children: removeNode<T>(n.children, id)));
}
return out;
}