Asset constructor
Asset({
- required WebRequest rq,
- required dynamic path,
- AssetType type = AssetType.none,
- AssetCache cache = AssetCache.appVersion,
- Map<
String, Object> data = const {}, - Map<
String, Object> attrs = const {},
Creates an instance of Asset.
The rq
parameter is the current web request.
The path
parameter is the path to the asset.
The type
parameter specifies the type of the asset (JS or CSS).
The cache
parameter controls the cache policy for the asset.
Implementation
Asset({
required this.rq,
required path,
this.type = AssetType.none,
this.cache = AssetCache.appVersion,
this.data = const {},
this.attrs = const {},
}) {
_path = path;
if (type == AssetType.none) {
final extention = p.extension(path).toLowerCase();
switch (extention) {
case '.js':
type = AssetType.js;
break;
case '.css':
type = AssetType.css;
break;
}
}
}