resolveParentPath static method
Resolves a parent reference (route name or path) to the parent route's
PATH, or null when no route matches.
Accepted forms: exact route name ('dashboard'), exact path
('/dashboard'), and slash-less path ('dashboard' matching
/dashboard when no route is NAMED dashboard).
Implementation
static String? resolveParentPath(String ref, List<RouteEntryInfo> routes) {
final normalizedRef = _stripSlashes(ref);
for (final route in routes) {
if (route.name == ref) return route.path;
}
for (final route in routes) {
if (_stripSlashes(route.path) == normalizedRef) return route.path;
}
return null;
}