MessageEntity.fromJson constructor

MessageEntity.fromJson(
  1. dynamic data
)

Implementation

MessageEntity.fromJson(data) {
  Map<String, dynamic> json =
      data is Map ? data.cast<String, dynamic>() : jsonDecode(data);
  if (json['msgID'] != null) msgID = json["msgID"];
  if (json['timestamp'] != null) timestamp = json["timestamp"];
  if (json['sender'] != null) sender = json["sender"];
  if (json['nickName'] != null) nickName = json["nickName"];
  if (json['friendRemark'] != null) friendRemark = json["friendRemark"];
  if (json['faceUrl'] != null) faceUrl = json["faceUrl"];
  if (json['nameCard'] != null) nameCard = json["nameCard"];
  if (json['groupID'] != null) groupID = json["groupID"];
  if (json['userID'] != null) userID = json["userID"];
  if (json["status"] != null)
    status = MessageStatusTool.getByInt(json["status"]);
  if (json["elemType"] != null)
    elemType = MessageElemTypeTool.getByInt(json["elemType"]);
  if (json['localCustomData'] != null)
    localCustomData = json["localCustomData"];
  if (json['localCustomInt'] != null) localCustomInt = json["localCustomInt"];
  if (json["self"] != null) self = json["self"];
  if (json["read"] != null) read = json["read"];
  if (json["peerRead"] != null) peerRead = json["peerRead"];
  if (json["priority"] != null)
    priority = MessagePriorityTool.getByInt(json["priority"]);
  if (json["offlinePushInfo"] != null)
    offlinePushInfo = OfflinePushInfoEntity.fromJson(json["offlinePushInfo"]);
  if (json['groupAtUserList'] != null)
    groupAtUserList = json["groupAtUserList"]?.cast<String>();
  if (json['seq'] != null) seq = json["seq"];
  if (json['note'] != null) note = json["note"];
  if (json['node'] != null)
    node = MessageElemTypeTool.getMessageNodeByMessageNodeType(
        elemType!, json["node"]);
  if (json['random'] != null) random = json["random"];
}