MediaChatMessage.fromJson constructor

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

Creates a MediaChatMessage instance from a JSON map.

Implementation

factory MediaChatMessage.fromJson(Map<String, dynamic> json) =>
    MediaChatMessage(
      isAudioRecorded: Platform.isAndroid
          ? json["isAudioRecorded"] ?? false
          : json["audioType"] == "recording"
              ? true
              : false,
      mediaCaptionText: json["mediaCaptionText"] ?? "",
      mediaDownloadStatus:
          getMediaDownloadStatus(json["mediaDownloadStatus"]),
      mediaDuration: json["mediaDuration"],
      mediaFileName: json["mediaFileName"],
      mediaFileSize: json["mediaFileSize"],
      mediaLocalStoragePath: json["mediaLocalStoragePath"],
      mediaProgressStatus: json["mediaProgressStatus"],
      mediaThumbImage: json["mediaThumbImage"]
          .toString()
          .replaceAll("\\\\n", "\\n")
          .replaceAll("\\n", "\n")
          .replaceAll("\n", "")
          .replaceAll(" ", ""),
      mediaUploadStatus: getMediaUploadStatus(json["mediaUploadStatus"]),
      messageId: json["messageId"],
      messageType: getMediaMessageType(json["messageType"]),
    );