addRoute method
Implementation
RouteNode addRoute(String path) {
final segments = _parsePath(path);
var currentNode = _root;
for (final segment in segments) {
final existingChild = currentNode.findChild(segment);
if (existingChild != null) {
currentNode = existingChild;
} else {
final newChild = RouteNode(segment, path);
currentNode.addChild(newChild);
currentNode = newChild;
}
}
return currentNode;
}