cancelTaskByUrl method

void cancelTaskByUrl(
  1. String url
)

Cancels a task by its URL and removes it from the task list.

Implementation

void cancelTaskByUrl(String url) {
  String? taskId =
      activeTasks.where((task) => task.url == url).firstOrNull?.id;
  if (taskId != null) {
    _isolatePool.notifyIsolate(taskId, DownloadStatus.CANCELLED);
  }
  allTasks.removeWhere((task) => task.url == url);
}