Asset constructor

Asset({
  1. required String path,
  2. AssetType type = AssetType.none,
  3. AssetCache cache = AssetCache.appVersion,
  4. Map<String, Object> data = const {},
  5. Map<String, Object> attrs = const {},
})

Creates an instance of Asset.

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 String 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;
    }
  }
}