cancel method
Cancel a running or queued task.
Implementation
void cancel(String taskId, [String reason = 'Cancelled by user']) {
final task = _tasks[taskId];
if (task == null) return;
task.cancel(reason);
_queue.remove(taskId);
_eventController.add(TaskCancelledEvent(taskId, reason));
if (task.isRunning) {
_runningCount--;
_processQueue();
}
}