GoRouter constructor
GoRouter({
- required List<
RouteBase> routes, - Codec<
Object?, Object?> ? extraCodec, - GoExceptionHandler? onException,
- GoRouterPageBuilder? errorPageBuilder,
- GoRouterWidgetBuilder? errorBuilder,
- GoRouterRedirect? redirect,
- Listenable? refreshListenable,
- int redirectLimit = 5,
- bool routerNeglect = false,
- String? initialLocation,
- bool overridePlatformDefaultLocation = false,
- Object? initialExtra,
- List<
NavigatorObserver> ? observers, - bool debugLogDiagnostics = false,
- String? restorationScopeId,
- bool requestFocus = true,
Default constructor to configure a GoRouter with a routes builder and an error page builder.
The routes
must not be null and must contain an GoRouter to match /
.
Implementation
factory GoRouter({
required List<RouteBase> routes,
Codec<Object?, Object?>? extraCodec,
GoExceptionHandler? onException,
GoRouterPageBuilder? errorPageBuilder,
GoRouterWidgetBuilder? errorBuilder,
GoRouterRedirect? redirect,
Listenable? refreshListenable,
int redirectLimit = 5,
bool routerNeglect = false,
String? initialLocation,
bool overridePlatformDefaultLocation = false,
Object? initialExtra,
List<NavigatorObserver>? observers,
bool debugLogDiagnostics = false,
GlobalKey<NavigatorState>? navigatorKey,
String? restorationScopeId,
bool requestFocus = true,
}) {
return GoRouter.routingConfig(
routingConfig: _ConstantRoutingConfig(
RoutingConfig(
routes: routes,
redirect: redirect ?? RoutingConfig._defaultRedirect,
redirectLimit: redirectLimit),
),
extraCodec: extraCodec,
onException: onException,
errorPageBuilder: errorPageBuilder,
errorBuilder: errorBuilder,
refreshListenable: refreshListenable,
routerNeglect: routerNeglect,
initialLocation: initialLocation,
overridePlatformDefaultLocation: overridePlatformDefaultLocation,
initialExtra: initialExtra,
observers: observers,
debugLogDiagnostics: debugLogDiagnostics,
navigatorKey: navigatorKey,
restorationScopeId: restorationScopeId,
requestFocus: requestFocus,
);
}