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

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

Replaces the current route with a named route.

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

Optionally returns a result to the previous route.

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

Implementation

Future<T?> pushReplacementNamed<T extends Object?, TO extends Object?>(
  String routeName, {
  TO? result,
  Object? arguments,
  bool rootNavigator = false,
}) =>
    Navigator.of(
      this,
      rootNavigator: rootNavigator,
    ).pushReplacementNamed(
      routeName,
      result: result,
      arguments: arguments,
    );