parentLocation property
Uri?
get
parentLocation
The closest terminal ancestor location, if one exists.
Implementation
Uri? get parentLocation {
for (var index = _matches.length - 2; index >= 0; index--) {
final match = _matches[index];
if (!match.route.terminal) continue;
final segments = location.pathSegments.take(match.pathEnd).toList();
return segments.isEmpty
? Uri(
path: '/',
queryParameters: location.queryParametersAll.isEmpty
? null
: location.queryParametersAll,
)
: Uri(
pathSegments: <String>['', ...segments],
queryParameters: location.queryParametersAll.isEmpty
? null
: location.queryParametersAll,
);
}
return null;
}