pushNamedAndRemoveUntilRoot<T extends Object?> method
Future<T?>
pushNamedAndRemoveUntilRoot<T extends Object?>(
- String routeName, {
- PageType pageType = PageType.flutter,
- bool isOpaque = true,
- bool animated = true,
- Map<
String, dynamic> ? arguments,
override
push 到指定页面,同时会清除从页面untilRouteName页面到指定routeName链路上的所有页面
@param routeName 要跳转的页面, @return T 泛型,用于指定返回类型
Implementation
@override
Future<T?> pushNamedAndRemoveUntilRoot<T extends Object?>(
String routeName, {
PageType pageType = PageType.flutter,
bool isOpaque = true,
bool animated = true,
Map<String, dynamic>? arguments,
}) async {
final result = await Navigator.of(rootContext).pushNamedAndRemoveUntil(
routeName,
(Route<dynamic> route) => route.isFirst,
arguments: arguments,
);
if (result is! T?) {
throw TypeError();
}
return result;
}