router/ny_router library

Classes

ArgumentsWrapper
ConditionalGuard
Conditionally apply a guard based on a predicate.
GuardStack
Compose multiple guards into a single guard.
NyArgument
Nylo Route Argument Contains the data passed from another route.
NyNavigator
The NyNavigator class is a singleton class that manages the routing of the application. It is a thin layer on top of Navigator to help you encapsulate and manage routing at one place.
NyQueryParameters
Nylo Query Parameters Contains the data passed from the URL. E.g. "/home-page?userId=2 data = {"userId": "2"}
NyRouteGuard
Base class for Nylo route guards.
NyRouteHistoryObserver
A NavigatorObserver that keeps track of the current route.
NyRouter
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.
NyRouterOptions
Options to configure a Nylo Router instance.
NyRouterRoute
The NyRouterRoute class is used to define a route in the Nylo Router.
PageNotFound
PageRequest
Legacy page request class for backward compatibility.
PageTransition<T>
A flexible page transition class that extends PageRouteBuilder to provide a variety of customizable transition animations between screens.
PageTransitionSettings
This class contains all page transition settings.
ParameterizedGuard<P>
A route guard that accepts configuration parameters.
RedirectConfig
Configuration for a redirect action.
RouteContext<T>
Immutable context passed to route guards.
RouteData
Route data class for navigation configuration.
RouteGuard
@deprecated Use NyRouteGuard instead. Legacy class interface for backward compatibility.
RouteMatch
Represents a matched route with its parameters.
RouteMatcher
The RouteMatcher class is used to match the route with the registered routes.
TransitionType
A utility class that simplifies the creation of page transitions by encapsulating transition types and their associated settings.

Enums

GuardResult
The result of a route guard check.
The NavigationType enum is used to define the type of navigation to be
PageTransitionType
Transition enum

Functions

nyRoutes(dynamic build(NyRouter router)) NyRouter
Builds the routes in the router.dart file
routeIf(bool condition, dynamic routeName, {dynamic data, Map<String, dynamic>? queryParameters, NavigationType navigationType = NavigationType.push, dynamic result, bool removeUntilPredicate(Route route)?, TransitionType? transitionType, PageTransitionType? pageTransitionType, PageTransitionSettings? pageTransitionSettings, dynamic onPop(dynamic value)?}) Future<void>
Navigate to a new route if a condition is met. If the condition is false, the route will not be navigated to.
routeTo(dynamic routeName, {dynamic data, Map<String, dynamic>? queryParameters, NavigationType navigationType = NavigationType.push, dynamic result, bool removeUntilPredicate(Route route)?, TransitionType? transitionType, PageTransitionType? pageTransitionType, PageTransitionSettings? pageTransitionSettings, int? tabIndex, dynamic onPop(dynamic value)?}) Future<void>
Navigate to a new route.
routeToAuthenticatedRoute({dynamic data, NavigationType navigationType = NavigationType.pushAndForgetAll, dynamic result, bool removeUntilPredicate(Route route)?, TransitionType? transitionType, PageTransitionType? pageTransitionType, PageTransitionSettings? pageTransitionSettings, dynamic onPop(dynamic value)?}) Future<void>
Navigate to the auth route.
routeToInitial({dynamic data, NavigationType navigationType = NavigationType.pushAndForgetAll, dynamic result, bool removeUntilPredicate(Route route)?, TransitionType? transitionType, PageTransitionType? pageTransitionType, PageTransitionSettings? pageTransitionSettings, dynamic onPop(dynamic value)?}) Future<void>
Navigate to the initial route.

Typedefs

ChildBuilder = Widget Function(BuildContext context)
Builder function type for creating child widget
NyRouterRouteBuilder = Widget Function(BuildContext context, NyArgument? args, NyQueryParameters? queryParameters)
The typedef for the route builder.
NyRouteView = Widget Function(BuildContext context)
RouteView = (String, Widget Function(BuildContext context))
Type definition for the route view.
TransitionPageBuilder = Widget Function(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation)
Builder function type for creating the transition page

Exceptions / Errors

RouteNotFoundError