Asset constructor

Asset({
  1. required WebRequest rq,
  2. required dynamic path,
  3. AssetType type = AssetType.none,
  4. AssetCache cache = AssetCache.appVersion,
  5. Map<String, Object> data = const {},
  6. 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;
    }
  }
}