execute method
Removes all tasks from the Done column.
Notifies listeners with a DoneColumnClearedEvent when successful. Returns a Result containing the list of removed tasks.
Parameters:
doneColumn: The Done column to clear
Implementation
Result<List<Task>> execute(KanbanColumn doneColumn) {
try {
if (!doneColumn.isDoneColumn()) {
throw OperationLimitedToDoneColumnException();
}
final removedTasks = List<Task>.from(doneColumn.tasks);
doneColumn.tasks.clear();
EventNotifier().notify(DoneColumnClearedEvent(removedTasks, doneColumn));
return Success(removedTasks);
} on OperationLimitedToDoneColumnException catch (e) {
return Failure(e.message);
} catch (e) {
throw TaskOperationException('Failed to clear Done column: ${e.toString()}');
}
}