pushNamed<T> function

Future<T?> pushNamed<T>(
  1. BuildContext context,
  2. String routeName, {
  3. Object? arguments,
  4. bool rootNavigator = false,
})

Pushes the route named routeName with arguments, like Navigator.pushNamed.

Implementation

Future<T?> pushNamed<T>(
  BuildContext context,
  String routeName, {
  Object? arguments,
  bool rootNavigator = false,
}) {
  return Navigator.of(
    context,
    rootNavigator: rootNavigator,
  ).pushNamed<T>(routeName, arguments: arguments);
}