popAndPush<T extends Object?, TO extends Object?> method

  1. @optionalTypeArgs
Future<T?> popAndPush<T extends Object?, TO extends Object?>(
  1. PageRouteInfo route, {
  2. TO? result,
  3. OnNavigationFailure? onFailure,
})

Pop the current route off the navigator and push the given route in its place.

if onFailure callback is provided, navigation errors will be passed to it otherwise they'll be thrown

Implementation

@optionalTypeArgs
Future<T?> popAndPush<T extends Object?, TO extends Object?>(
  PageRouteInfo route, {
  TO? result,
  OnNavigationFailure? onFailure,
}) {
  final scope = _findStackScope(route);
  scope.maybePop<TO>(result);
  return scope._push<T>(route, onFailure: onFailure);
}