page method

dynamic page(
  1. NyStatefulWidget widget, {
  2. PageTransitionType? transition,
  3. PageTransitionSettings? pageTransitionSettings,
  4. List<RouteGuard>? routeGuards,
})

Add a new page to the router.

Implementation

page(NyStatefulWidget widget,
    {PageTransitionType? transition,
    PageTransitionSettings? pageTransitionSettings,
    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,
      pageTransitionSettings: pageTransitionSettings,
      routeGuards: routeGuards));
}