idleDone method

Future idleDone()

Stops the IDLE mode, for example after receiving information about a new message. Requires a mailbox to be selected.

Implementation

Future idleDone() async {
  if (!_isInIdleMode) {
    print('$logName: idleDone(): ERROR not in IDLE mode');
    return;
  }
  _isInIdleMode = false;
  await writeText('DONE');
  final future = _idleCommandTask?.completer.future;
  if (isLogEnabled && future == null) {
    log('There is no current idleCommandTask or completer future $_idleCommandTask',
        initial: ClientBase.initialApp);
  }
  if (future != null) {
    await future;
  } else {
    await Future.delayed(const Duration(milliseconds: 200));
  }

  _idleCommandTask = null;
  return future;
}