requestReadReceipt method Null safety

void requestReadReceipt(
  1. {MailAddress? recipient}

Requests a read receipt by setting the Disposition-Notification-To header to from address.

Optionally specify a recipient address when no message sender is defined in the from field yet. Compare removeReadReceiptRequest


void requestReadReceipt({MailAddress? recipient}) {
  recipient ??= (from?.isNotEmpty ?? false) ? from!.first : null;
  if (recipient == null) {
    throw StateError(
        'Either define a sender in from or specify the recipient parameter');