removeRoute method

void removeRoute(
  1. Route route,
  2. Object? result
)

Removes the specified route from the navigation stack.

If the route corresponds to a StandardPageInterface, it performs necessary cleanup and updates the page stack accordingly. If the route does not correspond to a StandardPageInterface, it directly removes the route from the navigator.

Implementation

void removeRoute(Route<dynamic> route, Object? result) {
  final tRouteSettings = route.settings;
  if (tRouteSettings is StandardPageInterface) {
    if (_pageInstanceToPageType.containsKey(tRouteSettings)) {
      _onRemovePageInvoked(tRouteSettings, result, false);

      _updatePages();
    }
  } else {
    route.navigator?.removeRoute(route, result);

    _updatePages();
  }
}