void removeRouteBelow(Route anchorRoute)

Removes the route below the given anchorRoute. The route to be removed must not currently be visible. The anchorRoute must not be the first route in the history.

The removed route is disposed (see Route.dispose). The route prior to the removed route, if any, is notified (see Route.didChangeNext). The navigator observer is not notified.

Source

void removeRouteBelow(Route<dynamic> anchorRoute) {
  assert(!_debugLocked);
  assert(() { _debugLocked = true; return true; });
  assert(anchorRoute._navigator == this);
  int index = _history.indexOf(anchorRoute) - 1;
  assert(index >= 0);
  Route<dynamic> targetRoute = _history[index];
  assert(targetRoute._navigator == this);
  assert(targetRoute.overlayEntries.isEmpty || !overlay.debugIsVisible(targetRoute.overlayEntries.last));
  setState(() {
    _history.removeAt(index);
    Route<dynamic> newRoute = index < _history.length ? _history[index] : null;
    if (index > 0)
      _history[index - 1].didChangeNext(newRoute);
    targetRoute.dispose();
    targetRoute._navigator = null;
  });
  assert(() { _debugLocked = false; return true; });
}