removeRoute method

void removeRoute(
  1. BuildContext context
)

Remove the nearest page in context, if it exists. Do nothing if it doesn't exist.

Implementation

void removeRoute(BuildContext context) {
  assert(routerDelegate is StandardRouterDelegate);
  final tDelegate = routerDelegate as StandardRouterDelegate;

  final tRoute = ModalRoute.of(context);

  if (tRoute == null) {
    return;
  }

  tDelegate.removeRoute(tRoute, null);
}