pushNamed<T extends Object?> method

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

push 到一个已经存在路由表的页面

@param routeName 要跳转的页面 @param pageType PageType页面类型,默认PageType.flutter @param isOpaque 是否不透明 默认-true 不透明 @param animated 是否开启动画,默认开启 @param present iOS特有参数,默认false,当present = true时通过iOS的present方法打开新页面 @return T 泛型,用于指定返回类型

Implementation

@override
Future<T?> pushNamed<T extends Object?>(
  String routeName, {
  PageType pageType = PageType.flutter,
  bool isOpaque = true,
  bool animated = true,
  bool present = false,
  Map<String, dynamic>? arguments,
}) async {
  final result = await Navigator.pushNamed(
    rootContext,
    routeName,
    arguments: arguments,
  );
  if (result is! T?) {
    throw TypeError();
  }
  return result;
}