UserEntity.fromJson constructor

UserEntity.fromJson(
  1. dynamic data
)

Implementation

UserEntity.fromJson(data) {
  Map<String, dynamic> json =
      data is Map ? data.cast<String, dynamic>() : jsonDecode(data);
  if (json['userID'] != null) userID = json['userID'];
  if (json['nickName'] != null) nickName = json['nickName'];
  if (json['faceUrl'] != null) faceUrl = json['faceUrl'];
  if (json['selfSignature'] != null) selfSignature = json['selfSignature'];
  if (json['gender'] != null)
    gender = UserGenderTool.getByInt(json['gender']);
  if (json['role'] != null) role = json['role'];
  if (json['level'] != null) level = json['level'];
  if (json['allowType'] != null)
    allowType = UserAllowTypeTool.getByInt(json['allowType']);
  if (json['customInfo'] != null)
    customInfo = json['customInfo']?.cast<String, String>();
}