router/route library
Classes
-
ControllerAction<
T extends Object> - A route action that points to a method of a controller from the container. The controller is made once per isolate, at start.
- Route
- RouteBinding
- one binder added with Route.bind
Functions
-
route(
String name, {Map< String, Object?> params = const <String, Object?>{}, Map<String, Object?> query = const <String, Object?>{}, bool absolute = false, String? baseUrl}) → String -
the path of the route named
name, see Route.url. -
webSocketOriginAllowed(
String? origin, String? host, List< String> allowedOrigins) → bool -
true when a WebSocket upgrade with this
originmay open.
Typedefs
- FallbackCondition = bool Function(HttpRequest req)
-
true when a Route.fallback with
whenshould answerreq -
RawRequestHandler
= Future<
void> Function(HttpRequest request) - raw handler for every request under a path prefix, see Route.mount
-
RouteBinder<
T> = FutureOr< T?> Function(String value) - turns the raw text of a route param into a value, like a model. null means not found: the request gets 404.
- RouteErrorRenderer = DoxResponse? Function(Object error, DoxRequest req)
-
Gives the response for an
errorof a route, see Route.renderErrorsWith. null: Dox renders it as usual. -
WebSocketHandler
= FutureOr<
void> Function(WebSocket socket, DoxRequest req) - gets the open socket of a Route.websocket request