ApiShortUser.fromJson constructor

ApiShortUser.fromJson(
  1. dynamic json
)

Implementation

factory ApiShortUser.fromJson(dynamic json) {
  if (json == null) return ApiShortUser();

  // 사용자 정보가 없는 경우, Map 대신 빈 배열(List)로 들어온다.
  if (json is List) return ApiShortUser();

  // String photoIdx = "${json['photoIdx']}";
  // String url;
  // if (photoIdx != '' && photoIdx != '0') {
  //   url = Api.instance.thumbnailUrl(src: photoIdx, width: 100, height: 100, quality: 95);
  // }
  return ApiShortUser(
    idx: "${json['idx']}",
    name: json['name'] ?? '',
    nickname: json['nickname'] ?? '',
    gender: json['gender'] ?? '',
    birthdate: "${json['birthdate']}",
    point: "${json['point'] ?? 0}",
    photoIdx: "${json['photoIdx']}",
    photoUrl: "${json['photoUrl']}",
    firebaseUid: json['firebaseUid'] ?? '',
  );
}