toJson method

  1. @override
Map<String, dynamic> toJson()
override

Returns the JSON representation of this message.

Implementation

@override
Map<String, dynamic> toJson() => {
      'To': to.map((email) => email.toJson()).toList(),
      'Subject': subject,
      'From': from.toJson(),
      if (replyTo != null) 'ReplyTo': replyTo!.toJson(),
      if (textBody != null) 'TextBody': textBody,
      if (htmlBody != null) 'HtmlBody': htmlBody,
      if (ampBody != null) 'AmpBody': ampBody,
      if (apiTemplate != null) 'ApiTemplate': apiTemplate,
      if (messageId != null) 'MessageId': messageId,
      if (mailingId != null) 'MailingId': mailingId,
      if (charset != null) 'Charset': charset,
      if (mergeData != null) 'MergeData': mergeData!.toJson(),
    };