Controller class abstract

Base class for request handling objects.

A controller is a discrete processing unit for requests. These units are linked together to form a series of steps that fully handle a request.

Subclasses must implement handle to respond to, modify or forward requests. This class must be subclassed. Router and ResourceController are common subclasses.

Implemented types




hashCode int
The hash code for this object.
no setterinherited
logger Logger
An instance of the 'liquidart' logger.
no setter
nextController Controller?
Receives requests that this controller does not respond to.
no setter
policy CORSPolicy?
The CORS policy of this controller.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


applyCORSHeadersIfNecessary(Request req, Response resp) → void
didAddToChannel() → void
Lifecycle callback, invoked after added to channel, but before any requests are served.
documentComponents(APIDocumentContext context) → void
Tells this object to add its components to context.
documentOperations(APIDocumentContext context, String route, APIPath path) Map<String, APIOperation>
Tells this object to return all APIOperations it handles.
documentPaths(APIDocumentContext context) Map<String, APIPath>
Tells this object to return all APIPaths it handles.
handle(Request request) FutureOr<RequestOrResponse?>
The primary request handling method of this object.
handleError(Request request, dynamic caughtValue, StackTrace trace) Future
Sends an HTTP response for a request that yields an exception or error.
Links a controller to the receiver to form a request channel.
linkFunction(FutureOr<RequestOrResponse?> handle(Request request)) Linkable
Links a function controller to the receiver to form a request channel.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
receive(Request req) Future
Delivers req to this instance to be processed.
toString() String
A string representation of this object.
willSendResponse(Response response) → void
Executed prior to Response being sent.


operator ==(Object other) bool
The equality operator.

Static Properties

includeErrorDetailsInServerErrorResponses bool
Returns a stacktrace and additional details about how the request's processing in the HTTP response.
getter/setter pair
letUncaughtExceptionsEscape bool
Whether or not to allow uncaught exceptions escape request controllers.
getter/setter pair