Route class
Helps builds a route handler with its interceptors and exception handlers
Constructors
-
Route(String path, RouteHandler handler, {List<
String> methods = const <String>['*'], Map<String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route
factory
-
Route.delete(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for DELETE method requests
factory
-
Route.deleteJson(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor = jsonResponseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for JSON requests with DELETE method
factory
-
Route.fromInfo(HttpMethod info, RouteHandler handler, {List<
RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Route.get(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for GET method requests
factory
-
Route.getJson(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor = jsonResponseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for JSON requests with GET method
factory
-
Route.html(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType = MimeTypes.html, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for HTML requests
factory
-
Route.json(String path, RouteHandler handler, {List<
String> methods = const <String>['GET', 'PUT', 'POST', 'DELETE'], Map<String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor = jsonResponseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for JSON requests
factory
-
Route.options(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for OPTIONS method requests
factory
-
Route.patch(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for PATCH method requests
factory
-
Route.post(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for POST method requests
factory
-
Route.postJson(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor = jsonResponseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for JSON requests with POST method
factory
-
Route.put(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for PUT method requests
factory
-
Route.putJson(String path, RouteHandler handler, {Map<
String, String> pathRegEx, int statusCode = 200, String mimeType, String charset = kDefaultCharset, ResponseProcessor responseProcessor = jsonResponseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) -
Constructs a Route for JSON requests with PUT method
factory
Properties
- handler ↔ RouteHandler
-
The route handler function
read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- info → HttpMethod
-
final
-
pathSegments
→ Iterable<
String> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
after(
RouteInterceptor interceptor, [List< RouteInterceptor> interceptors]) → void -
Add
interceptor
and optionallyinterceptors
to be executed after handler in the route chain. -
before(
RouteInterceptor interceptor, [List< RouteInterceptor> interceptors]) → void -
Add
interceptor
and optionallyinterceptors
to be executed before handler in the route chain. -
call(
Context ctx) → Future< void> - Handles requests
-
cloneWith(
{String path, int statusCode, String mimeType, String charset, Map< String, String> headers, Map<String, String> pathRegEx, ResponseProcessor responseProcessor, List<RouteInterceptor> after, List<RouteInterceptor> before, List<ExceptionHandler> onException}) → Route - Clones this Route with the new values if provided
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
onException(
ExceptionHandler exceptHandler, [List< ExceptionHandler> exceptHandlers]) → void -
Add
exceptHandler
and optionallyexceptHandlers
to be executed after handler in the route chain. -
toString(
) → String -
Helps while debugging in variables window
override
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited