popRoute method

void popRoute([
  1. String? route
])

Pops the given route from the router stack history. Defaults to the current route.

Implementation

void popRoute([String? route]) {
  route ??= _routeHistory.last;

  if (!_routeHistory.contains(route)) {
    return;
  }

  setState(() {
    _routeHistory.remove(route);
    children![routeIndices[route]!].onPop?.call();
  });

  _notifyRouteChange();
}