page method
dynamic
page(
- NyStatefulWidget widget, {
- PageTransitionType? transition,
- List<
RouteGuard> ? routeGuards,
Add a new page to the router.
Implementation
page(NyStatefulWidget widget,
{PageTransitionType? transition, List<RouteGuard>? routeGuards}) {
String widgetRouteName = widget.getRouteName();
assert(
widgetRouteName != "",
"${widget.toString()} is missing a route name. \nAdd\n" +
"""
@override
String getRouteName() {
return "/your-route-name";
}""" +
"\nto your \"${widget.toString()}\" widget class.");
this._addRoute(NyRouterRoute(
name: widgetRouteName,
view: (context) => widget,
pageTransitionType: transition ?? PageTransitionType.rightToLeft,
routeGuards: routeGuards));
}