cancelTask method

  1. @override
Future<bool> cancelTask(
  1. String taskId
)
override

Cancels an ongoing transfer task.

Parameters:

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;
}