NyRouter class

NyRouterRoute manages routing, registering routes with transitions, navigating to routes, closing routes. It is a thin layer on top of Navigator to help you encapsulate and manage routing at one place.

Constructors

NyRouter({NyRouterOptions options = const NyRouterOptions()})

Properties

hashCode int
The hash code for this object.
no setterinherited
no setter
options NyRouterOptions
Configuration options for NyRouterRoute.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(RouteView routeView, {PageTransitionType? transition, PageTransitionSettings? pageTransitionSettings, List<NyRouteGuard>? routeGuards, bool initialRoute = false, bool authPage = false}) NyRouterRoute
Add a new route with a RouteView.
addRouteHistory(Route route) → dynamic
Add the route to the history.
addRoutes(List<NyRouterRoute> routes) → void
Add a list of routes at once.
generator({Widget builder(BuildContext context, Widget widget)?}) RouteFactory
Generates the RouteFactory which builds a Route on request.
getAuthRouteName() String?
Retrieves the auth route name from your router.
getCurrentRoute() Route?
Get the current route.
getInitialRouteName() String
Retrieves the initial route name from your router.
getPreviousRoute() Route?
Get the previous route.
getRegisteredRouteNames() List<String>
Get the registered routes names as a list.
getRegisteredRoutes() Map<String, NyRouterRoute>
Get the registered routes as a list.
getRouteHistory() List<Route>
Get the route history.
group(Map<String, dynamic> settings(), dynamic router(NyRouter router)) → dynamic
Group routes settings is a function that returns a map of settings. router is a function that returns a router. Example:
Function used to navigate pages.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeLastRouteHistory() → dynamic
Remove the last route from the history.
removeRouteHistory(Route route) → dynamic
Remove the route from the history.
route(String name, NyRouteView view, {PageTransitionType? transition, PageTransitionSettings? pageTransitionSettings, List<NyRouteGuard>? routeGuards, bool initialRoute = false, bool authPage = false}) NyRouterRoute
Add a new route with a widget.
setNyRoutes(NyRouter router) → void
Set the registered routes.
setRegisteredRoutes(Map<String, NyRouterRoute> routes) → void
Set the registered routes.
toString() String
A string representation of this object.
inherited
updateRoute(NyRouterRoute route) → dynamic
Updates a named route.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

args<T extends NyArgument?>(BuildContext context) → T?
Retrieves the arguments passed in when calling the navigate function.
getInitialRoute() String
Find the initial route.
unknownRouteGenerator() RouteFactory
Unknown route generator.