dart_router_extended library

Support for doing something awesome.

More dartdocs go here.

Classes

AbstractRoute
Cascade
A helper that calls several handlers in sequence and returns the first acceptable response.
Controller
DefaultRouteGuard
ErrorJson
HttpRequest
IOServer
A Server backed by a dart:io HttpServer.
JsonRequest
JsonResponse
Pipeline
A helper that makes it easy to compose a set of Middleware and a Handler.
Request
An HTTP request to be processed by a Shelf application.
Response
The response returned by a Handler.
Route
Annotation for handler methods that requests should be routed when using package shelf_router_generator.
RouteBuilder
RouteGuard
Router
A shelf Router routes requests to handlers based on HTTP verb and route pattern.
Server
An adapter with a concrete URL.
ServerHandler
A connected pair of a Server and a Handler.
ToJson

Enums

Method

Extensions

MiddlewareExtensions on Middleware
Extensions on Middleware to aid in composing Middleware and Handlers.
RouterParams on Request

Constants

defaultGuard → const DefaultRouteGuard

Properties

addChunkedEncoding Middleware
Middleware that adds chunked transfer coding to a responses if none of the following conditions are true:
final

Functions

createMiddleware({FutureOr<Response?> requestHandler(Request)?, FutureOr<Response> responseHandler(Response)?, FutureOr<Response> errorHandler(Object error, StackTrace)?}) Middleware
Creates a Middleware using the provided functions.
handleRequest(HttpRequest request, Handler handler, {String? poweredByHeader = 'Dart with package:shelf'}) Future<void>
Uses handler to handle request.
logRequests({void logger(String message, bool isError)?}) Middleware
Middleware which prints the time of the request, the elapsed time for the inner handlers, the response's status code and the request URI.
params(Request request, String name) String
Get a URL parameter captured by the Router.
serve(Handler handler, Object address, int port, {SecurityContext? securityContext, int? backlog, bool shared = false, String? poweredByHeader = 'Dart with package:shelf'}) Future<HttpServer>
Starts an HttpServer that listens on the specified address and port and sends requests to handler.
serveRequests(Stream<HttpRequest> requests, Handler handler, {String? poweredByHeader = 'Dart with package:shelf'}) → void
Serve a Stream of HttpRequests.

Typedefs

Handler = FutureOr<Response> Function(Request request)
A function which handles a Request.
JsonObject = Map<String, dynamic>
Middleware = Handler Function(Handler innerHandler)
A function which creates a new Handler by wrapping a Handler.

Exceptions / Errors

HijackException
An exception used to indicate that a request has been hijacked.