NyRouterRoute constructor

NyRouterRoute({
  1. required String name,
  2. required NyRouteView view,
  3. NyArgument? defaultArgs,
  4. NyQueryParameters? queryParameters,
  5. List<RouteGuard>? routeGuards,
  6. PageTransitionType? pageTransitionType,
  7. PageTransitionSettings? pageTransitionSettings,
  8. dynamic initialRoute = false,
  9. dynamic unknownRoute = false,
  10. 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;
  };
}