removeRoute method
Removes a route from the tree.
Implementation
void removeRoute(String path) {
final segments = _parsePath(path);
var currentNode = _root;
// Traverse the tree to find the node to delete
for (final segment in segments) {
final child = currentNode.findChild(segment);
if (child == null) return; // Node not found, nothing to delete
currentNode = child;
}
// Remove the node if it exists
currentNode.parent?.removeChild(currentNode);
}