selectInbox method Null safety

Future<Mailbox> selectInbox(
  1. {bool enableCondstore = false,
  2. QResyncParameters? qresync}
)

Shortcut to select the INBOX.

Optionally specify if CONDSTORE support should be enabled with enableCondstore - for IMAP servers that support CONDSTORE only. Optionally specify quick resync parameters with qresync - for IMAP servers that support QRESYNC only.

Implementation

Future<Mailbox> selectInbox(
    {bool enableCondstore = false, QResyncParameters? qresync}) async {
  var mailboxes = _mailboxes;
  mailboxes ??= await listMailboxes();
  var inbox = mailboxes.firstWhereOrNull((box) => box.isInbox);
  inbox ??=
      mailboxes.firstWhereOrNull((box) => box.name.toLowerCase() == 'inbox');
  if (inbox == null) {
    throw MailException(this, 'Unable to find inbox');
  }
  return selectMailbox(inbox,
      enableCondstore: enableCondstore, qresync: qresync);
}