FileController class Null safety

Serves files from a directory on the filesystem.

See the constructor for usage.

Inheritance

Constructors

FileController(String pathOfDirectoryToServe, {FutureOr<Response> onFileNotFound(FileController controller, Request req)?})
Creates a controller that serves files from pathOfDirectoryToServe.

Properties

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

Methods

addCachePolicy(CachePolicy policy, bool shouldApplyToPath(String path)) → void
Add a cache policy for file paths that return true for shouldApplyToPath.
applyCORSHeadersIfNecessary(Request req, Response resp) → void
inherited
cachePolicyForPath(String path) CachePolicy?
Returns the CachePolicy for path.
contentTypeForExtension(String extension) ContentType?
Returns a ContentType for a file extension.
didAddToChannel() → void
Lifecycle callback, invoked after added to channel, but before any requests are served.
inherited
documentComponents(APIDocumentContext context) → void
Tells this object to add its components to context.
inherited
documentOperations(APIDocumentContext context, String route, APIPath path) Map<String, APIOperation>
Tells this object to return all APIOperations it handles.
override
documentPaths(APIDocumentContext context) Map<String, APIPath>
Tells this object to return all APIPaths it handles.
inherited
handle(Request request) Future<RequestOrResponse>
The primary request handling method of this object.
override
handleError(Request request, dynamic caughtValue, StackTrace trace) Future
Sends an HTTP response for a request that yields an exception or error.
inherited
Links a controller to the receiver to form a request channel.
inherited
linkFunction(FutureOr<RequestOrResponse?> handle(Request request)) Linkable?
Links a function controller to the receiver to form a request channel.
inherited
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.
inherited
setContentTypeForExtension(String extension, ContentType contentType) → void
Sets the associated content type for a file extension.
toString() String
A string representation of this object.
inherited
willSendResponse(Response response) → void
Executed prior to Response being sent.
inherited

Operators

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