toJson method

Map<String, dynamic> toJson()

Converts a ChatMessage instance to a JSON map.

Implementation

Map<String, dynamic> toJson() => {
      "chatUserJid": chatUserJid,
      "contactType": contactType,
      "isItCarbonMessage": isItCarbonMessage,
      "isItSavedContact": isItSavedContact,
      "isMessageDeleted": isMessageDeleted,
      "isMessageRecalled": isMessageRecalled,
      "isMessageSentByMe": isMessageSentByMe,
      "isMessageStarred": isMessageStarred,
      "isSelected": isSelected,
      "isThisAReplyMessage": isThisAReplyMessage,
      "messageChatType": messageChatType,
      "messageCustomField": messageCustomField,
      "messageId": messageId,
      "messageSentTime": messageSentTime,
      "messageStatus": messageStatus,
      "isMessageEdited": isMessageEdited,
      "messageTextContent": messageTextContent,
      "messageType": messageType,
      "metaData": metaData == null
          ? null
          : List<dynamic>.from(metaData!.map((x) => x.toJson())),
      "replyParentChatMessage":
          replyParentChatMessage ?? replyParentChatMessage?.toJson(),
      "senderNickName": senderNickName,
      "senderUserJid": senderUserJid,
      "senderUserName": senderUserName,
      "contactChatMessage":
          contactChatMessage ?? contactChatMessage?.toJson(),
      "mediaChatMessage": mediaChatMessage ?? mediaChatMessage?.toJson(),
      "locationChatMessage":
          locationChatMessage ?? locationChatMessage?.toJson(),
      "topicId": topicId
    };