pushNamedAndRemoveUntil<T extends Object?> method

Future<T?> pushNamedAndRemoveUntil<T extends Object?>(
  1. String routeName, {
  2. Object? arguments,
  3. bool rootNavigator = false,
})

Pushes a named route onto the navigator and removes all previous routes.

Allows passing arguments to the route. rootNavigator determines whether to push the route onto the root navigator or the nearest Navigator ancestor.

Returns a Future that completes with the result of the pushed route when it is popped.

Implementation

Future<T?> pushNamedAndRemoveUntil<T extends Object?>(
  String routeName, {
  Object? arguments,
  bool rootNavigator = false,
}) {
  return Navigator.of(
    this,
    rootNavigator: rootNavigator,
  ).pushNamedAndRemoveUntil(routeName, (Route<dynamic> route) => false,
      arguments: arguments);
}