ConversationEntity.fromJson constructor

ConversationEntity.fromJson(
  1. dynamic data
)

Implementation

ConversationEntity.fromJson(data) {
  Map<String, dynamic> json =
      data is Map ? data.cast<String, dynamic>() : jsonDecode(data);
  if (json['conversationID'] != null) conversationID = json['conversationID'];
  if (json['type'] != null)
    type = ConversationTypeTool.getByInt(json['type']);
  if (json['userID'] != null) userID = json['userID'];
  if (json['groupID'] != null) groupID = json['groupID'];
  if (json['showName'] != null) showName = json['showName'];
  if (json['faceUrl'] != null) faceUrl = json['faceUrl'];
  if (json['recvOpt'] != null)
    recvOpt = GroupReceiveMessageOptTool.getByInt(json['recvOpt']);
  if (json['groupType'] != null)
    groupType = GroupTypeTool.getByString(json['groupType']);
  if (json['unreadCount'] != null) unreadCount = json['unreadCount'];
  if (json['lastMessage'] != null)
    lastMessage = MessageEntity.fromJson(json["lastMessage"]);
  if (json['draftText'] != null) draftText = json['draftText'];
  if (json['draftTimestamp'] != null) draftTimestamp = json['draftTimestamp'];
  if (json['groupAtInfoList'] != null)
    groupAtInfoList =
        ListUtil.generateOBJList<GroupAtInfoEntity>(json["groupAtInfoList"]);
}