buildSimpleTextMessage method Null safety

MimeMessage buildSimpleTextMessage(
  1. MailAddress from,
  2. List<MailAddress> to,
  3. String text,
  4. {List<MailAddress>? cc,
  5. List<MailAddress>? bcc,
  6. String? subject,
  7. HeaderEncoding subjectEncoding = HeaderEncoding.Q,
  8. DateTime? date,
  9. MimeMessage? replyToMessage,
  10. bool replyToSimplifyReferences = false,
  11. String? messageId,
  12. bool isChat = false,
  13. String? chatGroupId,
  14. CharacterSet characterSet = CharacterSet.utf8,
  15. TransferEncoding transferEncoding = TransferEncoding.quotedPrintable}

Creates a text message.

from the mandatory originator of the message to the mandatory list of recipients text the mandatory content of the message cc the optional "carbon copy" recipients that are informed about this message bcc the optional "blind carbon copy" recipients that should receive the message without others being able to see those recipients subject the optional subject of the message, if null and a replyToMessage is specified, then the subject of that message is being re-used. subjectEncoding the optional subject HeaderEncoding format date the optional date of the message, is set to by default replyToMessage is the message that this message is a reply to Set the optional replyToSimplifyReferences parameter to true in case only the root message-ID should be repeated instead of all references as calculated from the replyToMessage, messageId the optional custom message ID Set the optional isChat to true in case a COI-compliant message ID should be generated, in case of a group message also specify the chatGroupId. chatGroupId the optional ID of the chat group in case the message-ID should be generated. characterSet the optional character set, defaults to UTF8 encoding the otional message encoding, defaults to 8bit


static MimeMessage buildSimpleTextMessage(
    MailAddress from, List<MailAddress> to, String text,
    {List<MailAddress>? cc,
    List<MailAddress>? bcc,
    String? subject,
    HeaderEncoding subjectEncoding = HeaderEncoding.Q,
    DateTime? date,
    MimeMessage? replyToMessage,
    bool replyToSimplifyReferences = false,
    String? messageId,
    bool isChat = false,
    String? chatGroupId,
    CharacterSet characterSet = CharacterSet.utf8,
    TransferEncoding transferEncoding = TransferEncoding.quotedPrintable}) {
  final builder = MessageBuilder()
    ..from = [from] = to
    ..subject = subject
    ..subjectEncoding = subjectEncoding
    ..text = text = cc
    ..bcc = bcc = date
    ..originalMessage = replyToMessage
    ..replyToSimplifyReferences = replyToSimplifyReferences
    ..messageId = messageId
    ..isChat = isChat
    ..chatGroupId = chatGroupId
    ..characterSet = characterSet
    ..transferEncoding = transferEncoding;

  return builder.buildMimeMessage();