ApiUser.fromJson constructor
ApiUser.fromJson(
- Map<String, dynamic>? json
)
Implementation
ApiUser.fromJson(Map<String, dynamic>? json) {
if (json == null) return;
data = json;
admin = json['admin'] == 'Y' ? true : false;
nickname = json['nickname'];
firstName = json['first_name'];
lastName = json['last_name'];
locale = json['locale'];
autoLoginYn = json['autoLoginYn'];
autoStatusCheck = json['autoStatusCheck'];
plid = json['plid'];
agegroup = json['agegroup'];
gender = json['gender'];
foreign = json['foreign'];
telcoCd = json['telcoCd'];
ci = json['ci'];
phoneNo = json['phoneNo'];
name = json['name'];
birthday = json['birthday'];
birthdate = json['birthdate'];
idx = "${json['idx']}";
email = json['email'];
firebaseUid = json['firebaseUid'];
userRegistered = json['user_registered'];
sessionId = json['sessionId'];
mode = json['mode'];
photoIdx = "${json['photoIdx'] ?? 0}";
// 만약, 사용자가 프로필 사진을 업로드 했으면, 그것을 쓰고 아니면,
if (photoIdx.toInt > 0) {
photoUrl = Api.instance!.thumbnailUrl(src: photoIdx, width: 100, height: 100, quality: 95);
} else if (json['photoUrl'] != null) {
// 아니면, meta 에 기록된 photoUrl 을 사용한다.
photoUrl = json['photoUrl'];
}
point = "${json['point']}";
createdAt = "${json['createdAt'] ?? 0}";
updatedAt = "${json['updatedAt'] ?? 0}";
}