removeRoute method

void removeRoute (BuildContext context, Route route)

Immediately remove route from the navigator that most tightly encloses the given context, and Route.dispose it.

This method is used, for example, to instantly dismiss dropdown menus that are up when the screen's orientation changes.

Implementation

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