FileLoader class

A file-system-based asset loader.

Note: it assumes the path is related to rootDir. That is, /foo/foo.png will become $rootDir/foo/foo.png. To load an absolute path, please use loadAsset directly. For example,

loadAsset(connect, new FileAsset(new File.fromUri(uri)));
Inheritance

Constructors

FileLoader(String rootDir)

Properties

cache AssetCache
The cache. *
getter/setter pairinherited
cacheSize int
The total cache size (unit: bytes). Default: 3 * 1024 * 1024.
getter/setter pairinherited
cacheThreshold int
The thread hold (unit: bytes) to cache. Only resources less than this size
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
rootDir String
The root directory.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useETag bool
Whether to generate the ETag header. Default: true.
getter/setter pairinherited
useExpires bool
Whether to generate the Expires and max-age headers. Default: true.
getter/setter pairinherited

Methods

getAsset(String path) Asset
Returns the Asset instance representing path. *
override
getETag(Asset asset, DateTime lastModified, int assetSize) String?
Returns the value of the ETag header.
inherited
getExpires(Asset asset) Duration?
Returns the duration for the Expires and max-age headers.
inherited
load(HttpConnect connect, String uri, {bool useCache = true}) Future
Loads the asset of the given URI to the given response.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shallCache(Asset asset, int assetSize) bool
Whether the given asset shall be cached. *
inherited
toString() String
A string representation of this object.
inherited

Operators

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