getAncestorsOfKey method
Retrieves all ancestor item keys for a given item key in tree hierarchy.
Implementation
List<K> getAncestorsOfKey(K key) {
final ancestors = <K>[];
K? current = _itemsMap[key]?.parentKey;
while (current != null) {
ancestors.add(current);
current = _itemsMap[current]?.parentKey;
}
return ancestors.reversed.toList();
}