getParentPath static method
Extracts the parent path from a child path Examples:
- "1.1.2" returns "1.1"
- "1.1" returns "1"
- "1" returns null (root has no parent)
Implementation
static String? getParentPath(String childPath) {
final lastDotIndex = childPath.lastIndexOf('.');
if (lastDotIndex == -1) {
return null; // Root node has no parent
}
return childPath.substring(0, lastDotIndex);
}