removeRouteBelow method

void removeRouteBelow (BuildContext context, Route anchorRoute)

Immediately remove a route from the navigator that most tightly encloses the given context, and Route.dispose it. The route to be replaced is the one below the given anchorRoute.

The removed route is removed without being completed, so this method does not take a return value argument. No animations are run as a result of this method call.

The routes below and above the removed route are notified (see Route.didChangeNext and Route.didChangePrevious). If the Navigator has any Navigator.observers, they will be notified as well (see NavigatorObserver.didRemove). The removed route is disposed without being notified. The future that had been returned from pushing that routes will not complete.

The given anchorRoute must be in the history and must have a route below it; this method will throw an exception if it is not or does not.

Ongoing gestures within the current route are canceled.

Implementation

static void removeRouteBelow(BuildContext context, Route<dynamic> anchorRoute) {
  return Navigator.of(context).removeRouteBelow(anchorRoute);
}