add method
NyRouterRoute
add(
- RouteView routeView, {
- PageTransitionType? transition,
- PageTransitionSettings? pageTransitionSettings,
- List<
NyRouteGuard> ? routeGuards, - bool initialRoute = false,
- bool unknownRoute = false,
- bool authenticatedRoute = false,
Add a new route with a RouteView.
Implementation
NyRouterRoute add(RouteView routeView,
{PageTransitionType? transition,
PageTransitionSettings? pageTransitionSettings,
List<NyRouteGuard>? routeGuards,
bool initialRoute = false,
bool unknownRoute = false,
bool authenticatedRoute = false}) {
NyRouterRoute nyRouterRoute = NyRouterRoute(
name: routeView.$1,
view: (context) => routeView.$2(context),
pageTransitionType: transition,
pageTransitionSettings: pageTransitionSettings,
routeGuards: routeGuards,
initialRoute: initialRoute,
unknownRoute: unknownRoute,
authPage: authenticatedRoute);
_addRoute(nyRouterRoute, unknownRoute: unknownRoute);
assert(
_routeNameMappings.entries
.where((element) => element.value.getInitialRoute() == true)
.length <=
1,
'Your project has more than one initial route defined, please check your router file.');
return nyRouterRoute;
}