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
handler
forverb
requests toroute
. -
all(
String route, Function handler) → void -
Handle all request to
route
usinghandler
. -
call(
RequestContext context) → Future< Response> - Route incoming requests to registered handlers.
-
delete(
String route, Function handler) → void -
Handle
DELETE
request toroute
usinghandler
. -
get(
String route, Function handler) → void -
Handle
GET
request toroute
usinghandler
. -
head(
String route, Function handler) → void -
Handle
HEAD
request toroute
usinghandler
. -
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 toroute
usinghandler
. -
patch(
String route, Function handler) → void -
Handle
PATCH
request toroute
usinghandler
. -
post(
String route, Function handler) → void -
Handle
POST
request toroute
usinghandler
. -
put(
String route, Function handler) → void -
Handle
PUT
request toroute
usinghandler
. -
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