unselectMailbox method

Future<Mailbox?> unselectMailbox()

Closes the currently selected mailbox without triggering the expunge events.

Compare selectMailbox

Implementation

Future<Mailbox?> unselectMailbox() {
  if (_selectedMailbox == null) {
    return Future.value();
  }
  final cmd = Command(
    'UNSELECT',
    writeTimeout: defaultWriteTimeout,
    responseTimeout: defaultResponseTimeout,
  );
  final parser = NoResponseParser(_selectedMailbox);
  _selectedMailbox = null;
  // the type argument must match the parser, otherwise the task's
  // Response<void> cannot be handed to the parser at runtime
  return sendCommand<Mailbox?>(cmd, parser);
}