didReplace method

  1. @override
void didReplace({
  1. Route? newRoute,
  2. Route? oldRoute,
})
override

The Navigator replaced oldRoute with newRoute.

Implementation

@override
void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) {
  if (newRoute == null || oldRoute == null) {
    return;
  }
  final index = _routeStack.indexOf(oldRoute);
  if (index != -1) {
    _routeStack[index] = newRoute;
  }
  super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
  sendNavigatorStackChanged();
  PageLifeCycleManager.instance.notifyDidReplace(
    newRoute.settings.name ?? 'unknownFlutterRoute',
    oldRoute.settings.name ?? 'unknownFlutterRoute',
  );
}