updateFlatNodes method
void
updateFlatNodes()
Rebuilds the flatNodes list by traversing the tree starting from the root.
Implementation
void updateFlatNodes() {
flatNodes = [];
_flatten(widget.root, 0, [], true, flatNodes);
if (flatNodes.isNotEmpty) {
selectedIndex = selectedIndex.clamp(0, flatNodes.length - 1);
} else {
selectedIndex = 0;
}
}