Router class

A class that routes requests to handlers based on HTTP verb and route pattern.

Constructors

Router({Handler notFoundHandler = _defaultNotFound})
Creates a new Router routing requests to handlers.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(String verb, String route, Function handler) → void
Add handler for verb requests to route.
all(String route, Function handler) → void
Handle all request to route using handler.
call(RequestContext context) Future<Response>
Route incoming requests to registered handlers.
delete(String route, Function handler) → void
Handle DELETE request to route using handler.
get(String route, Function handler) → void
Handle GET request to route using handler.
Handle HEAD request to route using handler.
mount(String prefix, Function handler) → void
Mount a handler below a prefix.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
options(String route, Function handler) → void
Handle OPTIONS request to route using handler.
patch(String route, Function handler) → void
Handle PATCH request to route using handler.
post(String route, Function handler) → void
Handle POST request to route using handler.
put(String route, Function handler) → void
Handle PUT request to route using handler.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

routeNotFound Response
Sentinel Response object indicating that no matching route was found.
final