pushNamed<T> method

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

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

Example

context.pushNamed('/counterPage');

Implementation

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