UDormResponse.fromMap constructor
UDormResponse.fromMap(
- Map<String, dynamic> json
)
Implementation
factory UDormResponse.fromMap(Map<String, dynamic> json) => UDormResponse(
id: json["id"] as String,
createdAt: DateTime.parse(json["createdAt"]),
jsonData: UDormJson.fromMap(json["jsonData"]),
tags: List<int>.from(json["tags"]!.map((dynamic x) => x)),
creator: json["creator"] == null ? null : UUserResponse.fromMap(json["creator"]),
creatorId: json["creatorId"],
title: json["title"] as String,
cityCode: json["cityCode"] as String,
address: json["address"],
phoneNumber: json["phoneNumber"],
adminUserIds: json["adminUserIds"] == null ? <String>[] : List<String>.from(json["adminUserIds"]!.map((dynamic x) => x)),
averageScore: json["averageScore"] == null ? 0 : (json["averageScore"] as num).toDouble(),
commentCount: json["commentCount"] == null ? 0 : (json["commentCount"] as num).toInt(),
minMonthlyRent: json["minMonthlyRent"] == null ? null : (json["minMonthlyRent"] as num).toDouble(),
bedCount: json["bedCount"] ?? 0,
availableBedCount: json["availableBedCount"] ?? 0,
rooms: json["rooms"] == null ? <UDormRoomResponse>[] : List<UDormRoomResponse>.from(json["rooms"]!.map((dynamic x) => UDormRoomResponse.fromMap(x))),
beds: json["beds"] == null ? <UDormBedResponse>[] : List<UDormBedResponse>.from(json["beds"]!.map((dynamic x) => UDormBedResponse.fromMap(x))),
comments: json["comments"] == null ? <UCommentResponse>[] : List<UCommentResponse>.from(json["comments"]!.map((dynamic x) => UCommentResponse.fromMap(x))),
media: json["media"] == null ? <UMediaResponse>[] : List<UMediaResponse>.from(json["media"]!.map((dynamic x) => UMediaResponse.fromMap(x))),
);