route method
NyRouterRoute
route(
- String name,
- NyRouteView view, {
- PageTransitionType? transition,
- PageTransitionSettings? pageTransitionSettings,
- List<
NyRouteGuard> ? routeGuards, - bool initialRoute = false,
- bool unknownRoute = false,
- bool authenticatedRoute = false,
Add a new route with a widget.
Implementation
NyRouterRoute route(String name, NyRouteView view,
{PageTransitionType? transition,
PageTransitionSettings? pageTransitionSettings,
List<NyRouteGuard>? routeGuards,
bool initialRoute = false,
bool unknownRoute = false,
bool authenticatedRoute = false}) {
NyRouterRoute nyRouterRoute = NyRouterRoute(
name: name,
view: view,
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;
}