AssetLoader class abstract
A skeletal implementation of ResourceLoader that utilizes AssetCache and supports all HTTP requirements such as partial content, multi-part loading, ETag and more.
To implement your own loader, you can do the follows:
- Implements Asset to load your asset.
- Extends AssetLoader and override getAsset to return the Asset object you implemented for the given path.
Note: rootDir is not used in AssetLoader. Whether it is meaningful depends on how getAsset is implemented in derives.
- Implemented types
- Implementers
Constructors
Properties
- cache ↔ AssetCache
-
The cache.
*
getter/setter pair
- cacheSize ↔ int
-
The total cache size (unit: bytes). Default: 3 * 1024 * 1024.
getter/setter pair
- cacheThreshold ↔ int
-
The thread hold (unit: bytes) to cache. Only resources less than this size
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- rootDir → String
-
The root directory.
no setterinherited
- 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 pair
- useExpires ↔ bool
-
Whether to generate the Expires and max-age headers. Default: true.
getter/setter pair
Methods
-
getAsset(
String path) → Asset -
Returns the Asset instance representing
path
. * -
getETag(
Asset asset, DateTime lastModified, int assetSize) → String? - Returns the value of the ETag header.
-
getExpires(
Asset asset) → Duration? - Returns the duration for the Expires and max-age headers.
-
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. *
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited