push method

  1. @override
Future<void> push(
  1. DownloadTask task
)
override

Pushes the task to the download manager for processing. If the task is already in the download manager or cache, does nothing.

Implementation

@override
Future<void> push(DownloadTask task) async {
  Uint8List? dataMemory = await LruCacheSingleton().memoryGet(task.matchUrl);
  if (dataMemory != null) return;
  String cachePath = await FileExt.createCachePath(task.uri.generateMd5);
  File file = File('$cachePath/${task.saveFileName}');
  if (await file.exists()) return;
  task.cacheDir = cachePath;
  await VideoProxy.downloadManager.addTask(task);
}