pushNamedAndRemoveUntil<T extends Object?> static method

Future<T?> pushNamedAndRemoveUntil<T extends Object?>(
  1. String routeName,
  2. String untilRouteName, {
  3. PageType pageType = PageType.flutter,
  4. bool isOpaque = true,
  5. bool animated = true,
  6. Map<String, dynamic>? arguments,
})

push 到指定页面,同时会清除从页面pushNamedAndRemoveUntil页面到指定routeName链路上的所有页面

@param routeName 要跳转的页面 @param pageType PageType页面类型,默认PageType.flutter @param isOpaque 是否不透明 默认-true 不透明 @param animated 是否开启动画,默认开启 @parma untilRouteName 移除截止页面 @return T 泛型,用于指定返回类型, 仅支持flutter -> flutter的场景

Implementation

static Future<T?> pushNamedAndRemoveUntil<T extends Object?>(
  String routeName,
  String untilRouteName, {
  PageType pageType = PageType.flutter,
  bool isOpaque = true,
  bool animated = true,
  Map<String, dynamic>? arguments,
}) async {
  if (navigatorObserver.routeExists(untilRouteName) && pageType == PageType.flutter) {
    return await _flutterNavigator.pushNamedAndRemoveUntil<T>(
      routeName,
      untilRouteName,
      isOpaque: isOpaque,
      animated: animated,
      arguments: arguments,
    );
  } else {
    return await _nativeNavigator.pushNamedAndRemoveUntil<T>(
      routeName,
      untilRouteName,
      pageType: pageType,
      isOpaque: isOpaque,
      animated: animated,
      arguments: arguments,
    );
  }
}