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 _incomingLock.synchronized(
    () => _incomingMailClient.selectMailbox(
      mailbox,
      enableCondStore: enableCondStore,
      qresync: qresync,
    ),
  );

  _selectedMailbox = box;

  return box;
}