pop<T extends Object?> method

void pop<T extends Object?>([
  1. T? result
])

Pop the top-most route off the current screen.

If the top-most route is a pop up or dialog, this method pops it instead of any GoRoute under it.

Ensure that the value of routeInformationProvider is synced with routerDelegate.currentConfiguration.

Implementation

void pop<T extends Object?>([T? result]) {
  assert(() {
    log('popping ${routerDelegate.currentConfiguration.uri}');
    return true;
  }());
  final RouteMatchList configBeforePop = routerDelegate.currentConfiguration;
  routerDelegate.pop<T>(result);
  // Only restore when the pop completed synchronously (no onExit).
  // If deferred, currentConfiguration is still the same instance.
  if (!identical(routerDelegate.currentConfiguration, configBeforePop)) {
    restore(routerDelegate.currentConfiguration);
  }
}