Router class
A class that routes requests to handlers based on HTTP verb and route pattern.
Constructors
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
handlerforverbrequests toroute. -
all(
String route, Function handler) → void -
Handle all request to
routeusinghandler. -
call(
RequestContext context) → Future< Response> - Route incoming requests to registered handlers.
-
delete(
String route, Function handler) → void -
Handle
DELETErequest torouteusinghandler. -
get(
String route, Function handler) → void -
Handle
GETrequest torouteusinghandler. -
head(
String route, Function handler) → void -
Handle
HEADrequest torouteusinghandler. -
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
OPTIONSrequest torouteusinghandler. -
patch(
String route, Function handler) → void -
Handle
PATCHrequest torouteusinghandler. -
post(
String route, Function handler) → void -
Handle
POSTrequest torouteusinghandler. -
put(
String route, Function handler) → void -
Handle
PUTrequest torouteusinghandler. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- methodNotAllowed → Response
-
Sentinel Response object indicating that the http method
was not allowed for the requested route.
final
- routeNotFound → Response
-
Sentinel Response object indicating that no matching route was found.
final