pushReplacementNamed<T, X> method

Future<T?> pushReplacementNamed<T, X>(
  1. String routeName, {
  2. Object? arguments,
})

Equals to Navigator.of(context).pushReplacementNamed() Just give it the routeName you want to push

Example

context.pushReplacementNamed('/counterPage');

Implementation

Future<T?> pushReplacementNamed<T, X>(
  String routeName, {
  Object? arguments,
}) async =>
    Navigator.of(this).pushReplacementNamed<T, X>(
      routeName,
      arguments: arguments,
    );