StaticRoute class

Route for serving static assets.

Inheritance

Constructors

StaticRoute.directory(Directory root, {CacheBustingConfig? cacheBustingConfig, CacheControlFactory cacheControlFactory = _defaultFactory})
Use StaticRoute.directory to serve everything below a given root.
factory
StaticRoute.file(File file, {CacheControlFactory cacheControlFactory = _defaultFactory})
Use StaticRoute.file to serve a single file.
factory

Properties

asHandler Handler
Returns this HandlerObject as a Handler.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
methods Set<Method>
The methods this route will respond to, i.e. HTTP get or post.
finalinherited
path String
The suffix path this route will respond to.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(Request req) Future<Result>
Handles a call to this route, by extracting Session from request and forwarding to handleCall.
inherited
handleCall(Session session, Request request) FutureOr<Result>
Handles a call to this route.
override
injectIn(RelicRouter router) → void
Adds this handler to the given router with Method.get and path '/' Override to add differently.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

noStore() CacheControlFactory
Returns a CacheControlHeader with no-store.
privateNoCache() CacheControlFactory
Returns a CacheControlHeader with private and no-cache.
public({Duration? maxAge}) CacheControlFactory
Returns a CacheControlHeader with public, and possibly max-age set to maxAge.
publicImmutable({Duration? maxAge}) CacheControlFactory
Returns a CacheControlHeader with public, immutable, and possibly max-age set to maxAge.