didReplace method
The Navigator replaced oldRoute
with newRoute
.
Implementation
@override
void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) {
String? path = newRoute?.settings.name;
String? oldPath = oldRoute?.settings.name;
if (oldPath != null && oldPath != '') {
if (_routeList.contains(oldPath)) {
int index = _routeList.lastIndexOf(oldPath);
if (index > 0) _routeList.removeAt(index);
}
}
if (path != null && path != '') {
if (!_routeList.contains(path)) {
_routeList.add(path);
}
}
RRouter._print(
'RRouter --> did replace $path , old $oldPath , current top $topPath');
}