Router class

this router will return only one matching handler, it holds some handlers and their middlewares

Implemented types

Constructors

Router({RouterDoc? doc})

Properties

doc RouterDoc?
getter/setter pair
entities List<RoutingEntity>
no setter
handlers List<Handler>
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
self RequestProcessor
no setteroverride

Methods

addHandler(String pathTemplate, HttpMethod method, Processor processor, {List<Middleware> middlewares = const [], String? signature, HandlerDoc? docs}) Handler
addRawHandler(Handler handler) Handler
these are the handlers that will be chosen from to run if the path and the method are fulfilled
addRawMiddleware(Middleware middleware) Router
addRouterMiddleware(Processor processor, {String? signature, MiddlewareDoc? docs}) Router
routerMiddleware will work on it's following handlers in this router only and won't have any effect on other handlers of other routers or the handlers that are above the middleware in sequence router.get(handler1).get(handler2).addRouterMiddleware(middleware).get(handler3) this will only be added to handler3 only and won't be added to handler1 nor handler 2 it will work on every request for this router
addUpperMiddleware(String? pathTemplate, HttpMethod method, Processor processor, {String? signature, MiddlewareDoc? docs}) Router
upper middlewares will be add before any other handler or middleware in the router and they have their own order, so first added upper middlewares will be executed first and so on
addUpperRawMiddleware(Middleware middleware) Router
upper middlewares will be add before any other handler or middleware in the router and they have their own order, so first added upper middlewares will be executed first and so on
connect(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler
delete(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler
get(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler
insertMiddleware(String? pathTemplate, HttpMethod method, Processor processor, {String? signature, MiddlewareDoc? docs}) Router
routerMiddleware will work on it's following handlers in this router only and won't have any effect on other handlers of other routers or the handlers that are above the middleware in sequence router.get(handler1).get(handler2).addRouterMiddleware(middleware).get(handler3) this will only be added to handler3 only and won't be added to handler1 nor handler 2
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
options(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler
patch(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler
post(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler
processors(String path, HttpMethod method) List<RoutingEntity>
override
put(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler
setDoc() → void
toString() String
A string representation of this object.
inherited
trace(String pathTemplate, Processor processor, {String? signature, List<Middleware> middlewares = const [], HandlerDoc? docs}) Handler

Operators

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