pushNamedAndRemoveUntil<T> method

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

navigates to a new pages and remove until

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?> pushNamedAndRemoveUntil<T>(
  String routeName, {
  bool Function(Route<dynamic>)? predicate,
  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!.pushNamedAndRemoveUntil<T>(
      routeName,
      predicate ?? (_) => false,
      arguments: arguments,
    );
  }
  return _state!.pushAndRemoveUntil<T>(
    route,
    predicate ?? (_) => false,
  );
}