pushNamed<T> method

Future<T?> pushNamed<T>(
  1. String routeName, {
  2. Object? arguments,
  3. bool backGestureEnabled = true,
  4. Transition? transition,
  5. Duration? transitionDuration,
})

Push a named route onto the navigator.

transitionDuration is ignored when transition is equals to Transition.material or Transition.cupertino

backGestureEnabled not works on Android if transition is Transition.material

Implementation

Future<T?> pushNamed<T>(
  String routeName, {
  Object? arguments,
  bool backGestureEnabled = true,
  Transition? transition,
  Duration? transitionDuration,
}) {
  final route = _buildNamedRoute<T>(
    routeName: routeName,
    arguments: arguments,
    backGestureEnabled: backGestureEnabled,
    transition: transition,
    transitionDuration: transitionDuration,
  );
  if (route == null) {
    return _state!.pushNamed<T>(routeName, arguments: arguments);
  }
  return _state!.push<T>(route);
}