getMailbox method Null safety

Mailbox? getMailbox(
  1. MailboxFlag flag,
  2. [List<Mailbox>? boxes]
)

Retrieves the mailbox with the specified flag from the provided boxes. When no boxes are given, then the MailClient.mailboxes are used.

Implementation

Mailbox? getMailbox(MailboxFlag flag, [List<Mailbox>? boxes]) {
  boxes ??= mailboxes;
  return boxes?.firstWhereOrNull((box) => box.hasFlag(flag));
}