pushReplacementNamed<T, X> method
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,
);