didRemove method
The Navigator removed route
.
If only one route is being removed, then the route immediately below
that one, if any, is previousRoute
.
If multiple routes are being removed, then the route below the
bottommost route being removed, if any, is previousRoute
, and this
method will be called once for each removed route, from the topmost route
to the bottommost route.
Implementation
@override
void didRemove(Route<dynamic>? route, Route<dynamic>? previousRoute) {
String? path = route?.settings.name;
String? previousPath = previousRoute?.settings.name;
if (path != null && path != '') {
if (_routeList.contains(path)) {
int index = _routeList.lastIndexOf(path);
if (index > 0) _routeList.removeAt(index);
}
}
if (previousPath != null && previousPath != '') {
if (!_routeList.contains(previousPath)) {
_routeList.add(previousPath);
}
}
RRouter._print(
'RRouter --> did remove $path , previous $previousPath , current top $topPath');
}