popAndPushAll method

Future<void> popAndPushAll(
  1. List<PageRouteInfo> routes, {
  2. dynamic onFailure,
})

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

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

Implementation

Future<void> popAndPushAll(List<PageRouteInfo> routes, {onFailure}) {
  assert(routes.isNotEmpty);
  final scope = _findStackScope(routes.first);
  scope.maybePop();
  return scope._pushAll(routes, onFailure: onFailure, notify: true);
}