AppRouter class

基于 go_router 的路由工具类

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

context BuildContext?
获取当前的 BuildContext
no setter
goRouter → GoRouter
no setter
final

Static Methods

createRoute(String path, {required Widget child, GoRouterPageBuilder? pageBuilder}) → GoRoute
创建路由的快捷方法
createRouteByParam(String path, {required dynamic builder(BuildContext context, GoRouterState state, Map<String, String> pathParameters, Object? extra)?, String? name, GoRouterPageBuilder? pageBuilder, List<RouteBase> routes = const <RouteBase>[]}) → GoRoute
创建路由的快捷方法
go(String routeName, {Object? extra}) → void
直接跳转 (清除之前的路由栈)
goNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void
直接跳转 (使用 Name, 清除之前的路由栈)
init({required List<RouteBase> routes, String initialLocation = '/', GoRouterRedirect? redirect, Object? initialExtra, List<NavigatorObserver>? observers, bool debugLogDiagnostics = false}) → void
初始化 Router routes 路由列表 initialLocation 初始路由地址
openPage(String routeName, {Object? extra}) → void
跳转页面 (使用 pushNamed,符合参考实现)
openPageAndReplace(String routeName, {Object? extra}) → void
跳转页面并替换当前页面 (使用 replaceNamed,符合参考实现)
pop<T extends Object?>([T? result]) → void
返回上一页
pushNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void
跳转页面 (使用 Name)
replaceNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, String> queryParameters = const <String, String>{}, Object? extra}) → void
替换当前页面 (使用 Name)