selectMailboxByFlag method

Future<Mailbox> selectMailboxByFlag(
  1. MailboxFlag flag, {
  2. bool enableCondStore = false,
  3. QResyncParameters? qresync,
})

Selects the mailbox/folder with the specified flag.

Optionally specify if CONDSTORE support should be enabled with enableCondStore.

Optionally specify quick resync parameters with qresync.

Implementation

Future<Mailbox> selectMailboxByFlag(
  MailboxFlag flag, {
  bool enableCondStore = false,
  QResyncParameters? qresync,
}) async {
  var mailboxes = _mailboxes;
  mailboxes ??= await listMailboxes();
  final mailbox = getMailbox(flag, mailboxes);
  if (mailbox == null) {
    throw MailException(this, 'Unknown mailbox with flag <$flag>');
  }
  final box = await _incomingLock.synchronized(
    () => _incomingMailClient.selectMailbox(
      mailbox,
      enableCondStore: enableCondStore,
      qresync: qresync,
    ),
  );
  _selectedMailbox = box;

  return box;
}