V2TimConversation.fromJson constructor

V2TimConversation.fromJson(
  1. Map json
)

Implementation

V2TimConversation.fromJson(Map json) {
  json = Utils.formatJson(json);
  String? gid = json['groupID'] == "" ? null : json['groupID'];
  String? uid = json['userID'] == "" ? null : json['userID'];
  c2cReadTimestamp = json["c2cReadTimestamp"] ?? 0;
  groupReadSequence = json["groupReadSequence"] ?? 0;
  conversationID = json['conversationID'];
  type = json['type'];
  userID = uid;
  groupID = gid;
  showName = json['showName'];
  faceUrl = json['faceUrl'];
  groupType = json['groupType'];
  unreadCount = json['unreadCount'];
  isPinned = json['isPinned'];
  recvOpt = json['recvOpt'];
  orderkey = json['orderkey'];
  lastMessage = json['lastMessage'] != null
      ? V2TimMessage.fromJson(json['lastMessage'])
      : null;
  draftText = json['draftText'];
  customData = json['customData'];
  draftTimestamp = json['draftTimestamp'];
  if (json['markList'] != null) {
    markList = List.empty(growable: true);
    json['markList'].forEach((v) {
      markList?.add(v);
    });
  }
  if (json['conversationGroupList'] != null) {
    conversationGroupList = List.empty(growable: true);
    json['conversationGroupList'].forEach((v) {
      conversationGroupList?.add(v);
    });
  }

  if (json['groupAtInfoList'] != null) {
    groupAtInfoList = List.empty(growable: true);
    json['groupAtInfoList'].forEach((v) {
      groupAtInfoList!.add(V2TimGroupAtInfo.fromJson(v));
    });
  }
}