NyRouterRoute constructor

NyRouterRoute({
  1. required String name,
  2. required NyRouteView view,
  3. BaseArguments? defaultArgs,
  4. List<RouteGuard>? routeGuards,
  5. PageTransitionType pageTransitionType = PageTransitionType.rightToLeft,
})

Implementation

NyRouterRoute(
    {required this.name,
    required this.view,
    this.defaultArgs,
    this.routeGuards,
    this.pageTransitionType = PageTransitionType.rightToLeft}) {
  this.builder = (context, arg) {
    Widget widget = view(context);
    if (widget is NyStatefulWidget) {
      if (widget.controller != null) {
        widget.controller!.request =
            NyRequest(currentRoute: name, args: arg as NyArgument?);
        widget.controller!.construct(context);
      }
    }
    return widget;
  };
}