pushNamedRouteAndRemoveUntil<T extends Object?> method

Future<T?> pushNamedRouteAndRemoveUntil<T extends Object?>(
  1. String newRouteName,
  2. RoutePredicate predicate, {
  3. Object? args,
})

Pushes a named route onto the navigator stack and removes all previous routes until the predicate returns true.

The newRouteName parameter specifies the name of the new route to push. The predicate parameter determines the condition for stopping the removal of routes. The args parameter can be used to pass arguments to the new route.

Returns a Future that resolves to the value returned by the pushed route.

Implementation

Future<T?> pushNamedRouteAndRemoveUntil<T extends Object?>(
  String newRouteName,
  RoutePredicate predicate, {
  Object? args,
}) {
  return Navigator.of(this).pushNamedAndRemoveUntil<T>(
    newRouteName,
    predicate,
    arguments: args,
  );
}