deleteAllMessages method Null safety

Future<DeleteResult> deleteAllMessages(
  1. Mailbox mailbox,
  2. {bool? expunge}

Deletes all messages from the specified mailbox.

Optionally set expunge to true to clear the messages directly from disk on IMAP servers. In that case, the delete operation cannot be undone.


Future<DeleteResult> deleteAllMessages(Mailbox mailbox,
    {bool? expunge}) async {
  final result =
      await _incomingMailClient.deleteAllMessages(mailbox, expunge: expunge);
  mailbox.messagesExists = 0;
  mailbox.messagesRecent = 0;
  mailbox.messagesUnseen = 0;
  return result;