Controller class Null safety

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
Implementers

Constructors

Controller()

Properties

hashCode int
The hash code for this object.
read-onlyinherited
logger Logger
An instance of the 'conduit' logger.
read-only
nextController Controller?
Receives requests that this controller does not respond to.
read-only
policy CORSPolicy?
The CORS policy of this controller.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

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.
override
linkFunction(FutureOr<RequestOrResponse?> handle(Request request)) Linkable?
Links a function controller to the receiver to form a request channel.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
receive(Request req) Future?
Delivers req to this instance to be processed.
toString() String
A string representation of this object.
inherited
willSendResponse(Response response) → void
Executed prior to Response being sent.

Operators

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

Static Properties

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