deleteTask method
Deletes a task from the queue and cleans up associated resources. Returns true if the task was successfully deleted, false if the task wasn't found.
Parameters:
taskId: The ID of the task to delete
Implementation
@override
Future<bool> deleteTask(String taskId) async {
// First cancel any active task
await cancelTask(taskId);
// Remove from task details and current progress
_taskDetails.remove(taskId);
_currentProgress.remove(taskId);
_completedTasks.remove(taskId);
// Remove from queued operations if present
_queuedOperations.removeWhere((operation) {
// Since operations are functions, we can't directly identify which one
// belongs to this taskId. The cleanup above is sufficient since the
// task won't have any data to work with even if it runs.
return false;
});
return true;
}