Future pushReplacement(BuildContext context, Route route, { result })

Replace the current route by pushing route and then disposing the current route.

The new route and the route below the new route (if any) are notified (see Route.didPush and Route.didChangeNext). The navigator observer is not notified about the old route. The old route is disposed (see Route.dispose).

If a result is provided, it will be the return value of the old route, as if the old route had been popped.

Returns a Future that completes to the result value passed to pop when the pushed route is popped off the navigator.


static Future<dynamic> pushReplacement(BuildContext context, Route<dynamic> route, { dynamic result }) {
  return Navigator.of(context).pushReplacement(route, result: result);