ChatMessageModel.fromJson constructor

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

Converts a JSON object into a ChatMessageModel instance.

Implementation

factory ChatMessageModel.fromJson(Map<String, dynamic> json) =>
    ChatMessageModel(
        chatUserJid: json["chatUserJid"],
        contactType: json["contactType"],
        isItCarbonMessage: json["isItCarbonMessage"],
        isItSavedContact: json["isItSavedContact"],
        isMessageDeleted: json["isMessageDeleted"],
        isMessageRecalled: json["isMessageRecalled"],
        isMessageSentByMe: json["isMessageSentByMe"],
        isMessageStarred: json["isMessageStarred"],
        isSelected: json["isSelected"],
        isThisAReplyMessage: json["isThisAReplyMessage"],
        messageChatType: json["messageChatType"],
        messageCustomField: json["messageCustomField"] == null
            ? null
            : MessageCustomField.fromJson(json["messageCustomField"]),
        messageId: json["messageId"],
        messageSentTime: json["messageSentTime"],
        messageStatus: json["messageStatus"],
        isMessageEdited: json["isMessageEdited"],
        messageTextContent: json["messageTextContent"],
        messageType: json["messageType"],
        metaData: json["metaData"] == null
            ? []
            : List<MessageMetaData>.from(
                json["metaData"].map((x) => MessageMetaData.fromJson(x))),
        replyParentChatMessage: json["replyParentChatMessage"] == null
            ? null
            : ReplyParentChatMessage.fromJson(json["replyParentChatMessage"]),
        senderNickName: json["senderNickName"],
        senderUserJid: json["senderUserJid"],
        senderUserName: json["senderUserName"],
        contactChatMessage: json["contactChatMessage"] == null
            ? null
            : ContactChatMessage.fromJson(json["contactChatMessage"]),
        mediaChatMessage: json["mediaChatMessage"] == null
            ? null
            : MediaChatMessage.fromJson(json["mediaChatMessage"]),
        locationChatMessage: json["locationChatMessage"] == null
            ? null
            : LocationChatMessage.fromJson(json["locationChatMessage"]),
        topicId: json["topicId"]);