StaticFolder class

A folder of files served under a path prefix, see Route.staticFiles.

Constructors

StaticFolder(String prefix, String folder, {Duration? maxAge, String? domain})

Properties

domain → String?
the host of Route.domain (lower case), or null for every host
final
hashCode → int
The hash code for this object.
no setterinherited
maxAge → Duration?
sent as Cache-Control: public, max-age=... when set
final
prefix → List<String>
the prefix as path segments: /assets/ gives ['assets']
final
root → String
the folder as an absolute path
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

fileFor(List<String> segments) → File?
the file for segments (the decoded request path), or null when the path is not under prefix or is not safe. .., .env and other dot names, empty segments (a//b, a trailing /) and \ are refused, so no file outside root and no hidden file is sent. The one dot name allowed is a .well-known folder at the top of root (ACME challenges, security.txt). Dot names inside it are still refused.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
servesHost(String? host) → bool
true when the folder serves host (the Host header). The domain may have a port (localhost:3000) or not, like a domain route.
toString() → String
A string representation of this object.
inherited

Operators

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