path method
- String separator = hierarchyPathSeparator,
Compute the full hierarchical path by walking up the parent chain.
Uses separator between path segments (default /).
Returns just name for the root (no parent).
Implementation
String path({String separator = hierarchyPathSeparator}) {
if (_parent == null) {
return name;
}
final parts = <String>[];
HierarchyOccurrence? cur = this;
while (cur != null) {
parts.add(cur.name);
cur = cur._parent;
}
return parts.reversed.join(separator);
}