pushReplaceNamed method

Future pushReplaceNamed(
  1. String routeName, {
  2. Object? arguments,
})

Replace the current route of the navigator that most tightly encloses the given context with the route named routeName.

The arguments parameter is passed to the pushed route.

The return value is the value that the route that was removed was popped with; this route cannot interact with the route below itself, and the return value is null unless the removed route was popped with Navigator.pop (e.g. by pressing the back button on Android).

Implementation

Future<dynamic> pushReplaceNamed(
  final String routeName, {
  final Object? arguments,
}) =>
    Navigator.of(this).pushReplacementNamed(routeName, arguments: arguments);