checkAsset method
Implementation
Future<void> checkAsset({
AssetList? oldList,
bool nowWrite = true,
}) async {
final AssetList? assetList = await AssetList.readAssetDir(lib, options);
if (assetList == null) {
logger.warning(className, 'checkAsset失败,assetPaths不存在${options.assetPaths}', StackTrace.current);
} else {
await Future.wait(
list.values.map((AssetItem item) async {
final AssetItem? asset = assetList.get(item);
if (asset == null) {
await item.resume();
} else {
item.content = asset.content;
if (oldList?.get(item) == null) logger.info('add ${item.path}');
}
assetList.list.remove(item.path);
})
);
await Future.wait(
assetList.list.values.map((AssetItem item) async {
await item.remove();
})
);
}
if (nowWrite) await writeListFile();
}