MediaChatMessage.fromJson constructor
MediaChatMessage.fromJson(
- Map<String, dynamic> json
)
Implementation
factory MediaChatMessage.fromJson(Map<String, dynamic> json) => MediaChatMessage(
isAudioRecorded: Platform.isAndroid
? json["isAudioRecorded"] ?? false
: json["audioType"] == "recording"
? true
: false,
mediaCaptionText: json["mediaCaptionText"] ?? "",
mediaDownloadStatus: Platform.isIOS
? json["mediaDownloadStatus"] == 4
? 5
: json["mediaDownloadStatus"] == 5
? 3
: json["mediaDownloadStatus"] == 6
? 4
: json["mediaDownloadStatus"] == 7
? 6
: json["mediaDownloadStatus"] == 9
? 401
: json["mediaDownloadStatus"]
: json["mediaDownloadStatus"] == "not_downloaded"
? 5
: json["mediaDownloadStatus"] == "downloading"
? 3
: json["mediaDownloadStatus"] == "downloaded"
? 4
: json["mediaDownloadStatus"] == "not_available"
? 6
: json["mediaDownloadStatus"] == "failed"
? 401
: json["mediaDownloadStatus"],
mediaDuration: json["mediaDuration"],
mediaFileHeight: json["mediaFileHeight"] ?? 0,
mediaFileName: json["mediaFileName"],
mediaFileSize: json["mediaFileSize"],
// mediaFileType: json["mediaFileType"],
mediaFileType: Platform.isAndroid
? json["mediaFileType"]
: json["mediaFileType"].toString().toUpperCase() == "FILE"
? "DOCUMENT"
: json["mediaFileType"].toString().toUpperCase(),
mediaFileWidth: json["mediaFileWidth"] ?? 0,
mediaLocalStoragePath: json["mediaLocalStoragePath"],
mediaProgressStatus: json["mediaProgressStatus"],
mediaThumbImage: json["mediaThumbImage"]
.toString()
.replaceAll("\\\\n", "\\n")
.replaceAll("\\n", "\n")
.replaceAll("\n", "")
.replaceAll(" ", ""),
mediaUploadStatus: Platform.isIOS
? json["mediaUploadStatus"] == 3
? 7
: json["mediaUploadStatus"] == 8
? 401
: json["mediaUploadStatus"]
: json["mediaUploadStatus"] == "not_uploaded"
? 0
: json["mediaUploadStatus"] == "uploading"
? 1
: json["mediaUploadStatus"] == "uploaded"
? 2
: json["mediaUploadStatus"] == "not_available"
? 7
: json["mediaUploadStatus"] == "failed"
? 401
: json["mediaUploadStatus"],
messageId: json["messageId"],
messageType: Platform.isAndroid
? json["messageType"]
: json["mediaFileType"].toString().toUpperCase() == "FILE"
? "DOCUMENT"
: json["mediaFileType"],
isPlaying: false,
currentPos: 0,
);