cancelTask method
Cancels an ongoing transfer task.
Parameters:
taskId: The ID of the task to cancel, from either startDownload or startUpload
Returns true if the task was successfully cancelled, false otherwise.
Implementation
@override
Future<bool> cancelTask(String taskId) async {
final controller = _progressControllers[taskId];
if (controller == null) {
return false;
}
await controller.close();
_progressControllers.remove(taskId);
_completedTasks.remove(taskId);
return true;
}