flatten<T> static method
Flattens a tree of nodes into a list of FlatNodes, only including children of expanded nodes.
This produces the visible node list for virtualized rendering.
Implementation
static List<FlatNode<T>> flatten<T>({
required List<Node<T>> nodes,
required Set<String>? expandedNodeIds,
int depth = 0,
bool isRoot = true,
int ancestorIsLastMask = 0,
}) {
final result = <FlatNode<T>>[];
_flattenInto<T>(
result: result,
nodes: nodes,
expandedNodeIds: expandedNodeIds,
depth: depth,
isRoot: isRoot,
ancestorIsLastMask: ancestorIsLastMask,
);
return result;
}