MessageDetails.fromJson constructor

MessageDetails.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory MessageDetails.fromJson(Map<String, dynamic> json) {
  var attachmentsJson = json['attachments'] as List<dynamic>;
  List<Attachment> attachmentsList = attachmentsJson
      .map((attachmentJson) => Attachment.fromJson(attachmentJson))
      .toList();

  return MessageDetails(
    id: json['id'] as int,
    from: json['from'] as String,
    subject: json['subject'] as String,
    date: json['date'] as String,
    attachments: attachmentsList,
    body: json['body'] as String,
    textBody: json['textBody'] as String,
    htmlBody: json['htmlBody'] as String,
  );
}