executeTask method
Executes a task
, replacing any existing lower-priority task with the same cache key.
Schedules the isolate pool for task execution.
Implementation
Future<DownloadTask> executeTask(DownloadTask task) async {
DownloadTask? existTask =
_taskList.where((e) => e.matchUrl == task.matchUrl).firstOrNull;
if (existTask != null && existTask.priority < task.priority) {
_taskList.removeWhere((e) => e.matchUrl == task.matchUrl);
await addTask(task);
} else if (existTask == null) {
await addTask(task);
}
FunctionProxy.debounce(roundIsolate);
return task;
}