pushReplacementNamed<T extends Object?, TO extends Object?> method

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

replace the current page with a new route name

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?> pushReplacementNamed<T extends Object?, TO extends Object?>(
  String routeName, {
  Object? arguments,
  bool backGestureEnabled = true,
  Transition? transition,
  Duration? transitionDuration,
  TO? result,
}) {
  final route = _buildNamedRoute<T>(
    routeName: routeName,
    arguments: arguments,
    backGestureEnabled: backGestureEnabled,
    transition: transition,
    transitionDuration: transitionDuration,
  );
  if (route == null) {
    return _state!.pushReplacementNamed<T, TO>(
      routeName,
      arguments: arguments,
      result: result,
    );
  }
  return _state!.pushReplacement<T, TO>(route);
}