NyRouterRoute constructor
NyRouterRoute({
- required String name,
- required NyRouteView view,
- NyArgument? defaultArgs,
- NyQueryParameters? queryParameters,
- List<
RouteGuard> ? routeGuards, - PageTransitionType? pageTransitionType,
- PageTransitionSettings? pageTransitionSettings,
- dynamic initialRoute = false,
- dynamic unknownRoute = false,
- dynamic authPage = false,
Implementation
NyRouterRoute(
{required this.name,
required this.view,
this.defaultArgs,
this.queryParameters,
List<RouteGuard>? routeGuards,
this.pageTransitionType,
this.pageTransitionSettings,
initialRoute = false,
unknownRoute = false,
authPage = false})
: _initialRoute = initialRoute,
_unknownRoute = unknownRoute,
_authPage = authPage {
_routeGuards.addAll(routeGuards ?? []);
builder = (context, arg, queryParameters) {
Widget widget = view(context);
if (widget is NyStatefulWidget) {
widget.controller.request = NyRequest(
currentRoute: name,
args: arg,
queryParameters: queryParameters,
);
(widget.controller as NyController).routeGuards.addAll(_routeGuards);
widget.controller.construct(context);
if (widget.state != null) {
widget.controller.state = widget.state!;
}
}
return widget;
};
}