toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['conversationID'] = conversationID;
  data['type'] = type;
  data['userID'] = userID;
  data['groupID'] = groupID;
  data['showName'] = showName;
  data['faceUrl'] = faceUrl;
  data['groupType'] = groupType;
  data['unreadCount'] = unreadCount;
  data['isPinned'] = isPinned;
  data['recvOpt'] = recvOpt;
  data['orderkey'] = orderkey;
  data['customData'] = customData;
  data['c2cReadTimestamp'] = c2cReadTimestamp ?? 0;
  data['groupReadSequence'] = groupReadSequence ?? 0;

  if (lastMessage != null) {
    data['lastMessage'] = lastMessage!.toJson();
  }
  data['draftText'] = draftText;
  data['draftTimestamp'] = draftTimestamp;
  if (groupAtInfoList != null) {
    data['groupAtInfoList'] =
        groupAtInfoList!.map((v) => v!.toJson()).toList();
  }
  if (conversationGroupList != null) {
    data['conversationGroupList'] =
        conversationGroupList!.map((v) => v).toList();
  }
  if (markList != null) {
    data['markList'] = markList!.map((v) => v).toList();
  }
  return data;
}