clear method
Removes all pending tasks from the queue.
The Futures of these tasks will be completed with a QueueCancelledException.
Implementation
@override
void clear() {
// Complete pending tasks with cancellation before clearing
while (_queue.isNotEmpty) {
final item = _queue.removeFirst();
if (!item.completer.isCompleted) {
item.completer.completeError(QueueCancelledException());
}
}
}