pushAndPopUntil<T extends Object?> method
Future<T?>
pushAndPopUntil<T extends Object?>(
- PageRouteInfo route, {
- required RoutePredicate predicate,
- bool scopedPopUntil = true,
- OnNavigationFailure? onFailure,
Push the given route
onto the navigator, and then maybePop all the previous
routes until the predicate
returns true.
if onFailure
callback is provided, navigation errors will be passed to it
otherwise they'll be thrown
Implementation
@optionalTypeArgs
Future<T?> pushAndPopUntil<T extends Object?>(
PageRouteInfo route, {
required RoutePredicate predicate,
bool scopedPopUntil = true,
OnNavigationFailure? onFailure,
}) {
if (!scopedPopUntil) {
popUntil(predicate, scoped: false);
}
final scope = _findStackScope(route);
if (scopedPopUntil) {
scope.popUntil(predicate);
}
return scope._push<T>(route, onFailure: onFailure);
}