DownloadServiceTotalAssetItem.fromConfigCenter constructor
DownloadServiceTotalAssetItem.fromConfigCenter(
- Map<String, dynamic> json,
- String keyPath
)
Implementation
DownloadServiceTotalAssetItem.fromConfigCenter(
Map<String, dynamic> json, String keyPath) {
h5Path = keyPath;
DownloadServiceItem _createItem(String url, bool isCom) {
return DownloadServiceItem()
..h5Path = h5Path
..zipUrl = LocalServerConfiguration.downloadUrl(url)
..downloadCount = 0
..loadState = LoadStateType.unLoad
..isCompress = isCom
..filePath = [];
}
List<DownloadServiceItem> tmPAssets = [];
if (json['compress'] != null) {
tmPAssets.add(_createItem(json['compress'], true));
}
if (json['deps'] != null) {
List deps = json['deps'];
var tempDeps = deps.toList().map((e) => _createItem(e, false)).toList();
tmPAssets.addAll(tempDeps);
}
assets = tmPAssets;
}