Router class

A Router object used in creating/instantiating a new router.

A router is used in registering new routes and the corresponding components to be used in the given routes. A router is used for basic routing in an application to move between pages. Whenever the route of a page changes, the router issues the given PheasantTemplate for the new page and transmits it to any components with the p-route:view directive to render the given component in place of the view.

The router object consists of the initialRoute of the application, and the routes that the router uses, which is a list of RouteBase.

var router = Router(
  initialRoute: '/',
  routes: <RouteBase>[
    Route(
      path: '/',
      // References the generated component for the given file at that path
      component: RouteTo('src/Body.phs')
    )
  ]
);

Constructors

Router({String initialRoute = '/', Iterable<RouteBase> routes = const []})

Properties

hashCode int
The hash code for this object.
no setterinherited
initialRoute String
The initial route set by the router
final
mappedRoutes Map<String, PheasantTemplate>
The routes and their corresponding components as a Map
no setter
routes Iterable<RouteBase>
The routes registered for this router
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

globalRoutes Map<String, PheasantTemplate>
The global routes set by the application
getter/setter pair