cancel method
Implementation
Future<void> cancel(String id) async {
final UDownloadTask? task = this.task(id);
if (task == null || task.isFinished) return;
_scheduled.remove(id)?.cancel();
if (task.system) {
await UFilesChannel.systemCancel(id);
task.system = false;
}
final _Runner? runner = _runners[id];
if (runner != null) {
runner.stop(_StopReason.cancel);
return;
}
await _deletePart(task);
_finish(task, UDownloadStatus.canceled);
}