selectMailboxByPath method

Future<Mailbox> selectMailboxByPath(
  1. String path, {
  2. bool enableCondstore = false,
  3. QResyncParameters? qresync,
})

Selects the mailbox/folder with the specified path.

Optionally specify if CONDSTORE support should be enabled with enableCondstore. Optionally specify quick resync parameters with qresync.

Implementation

Future<Mailbox> selectMailboxByPath(String path,
    {bool enableCondstore = false, QResyncParameters? qresync}) async {
  var mailboxes = _mailboxes;
  mailboxes ??= await listMailboxes();
  final mailbox = mailboxes.firstWhereOrNull((box) => box.path == path);
  if (mailbox == null) {
    throw MailException(this, 'Unknown mailbox with path <$path>');
  }
  final box = await _incomingMailClient.selectMailbox(mailbox,
      enableCondstore: enableCondstore, qresync: qresync);
  _selectedMailbox = box;
  return box;
}