getAncestorPaths static method
Gets all ancestor paths for breadcrumb navigation Examples:
- "1.1.2" returns
"1", "1.1", "1.1.2" - "1" returns
"1"
Implementation
static List<String> getAncestorPaths(String path) {
final parts = path.split('.');
final ancestors = <String>[];
for (var i = 1; i <= parts.length; i++) {
ancestors.add(parts.take(i).join('.'));
}
return ancestors;
}