applyStashedTasks method
Applies the stashed tasks
Compare stashQueuedTasks
Implementation
Future<void> applyStashedTasks() async {
final stash = _stashedQueue;
_stashedQueue = null;
if (stash != null) {
for (final task in stash) {
final text = task.command.commandText;
try {
if (text == 'IDLE') {
if (!task.completer.isCompleted) {
task.completer.complete();
}
} else if (text == 'DONE') {
final completer = _idleCommandTask?.completer;
if (completer != null && !completer.isCompleted) {
completer.complete();
}
if (!task.completer.isCompleted) {
task.completer.complete();
}
} else if (text == 'NOOP') {
if (!task.completer.isCompleted) {
task.completer.complete(_selectedMailbox);
}
} else {
await _processTask(task);
}
} catch (e, s) {
print('Unable to apply stashed command $text: $e $s');
}
}
}
}