UHotelRoomResponse.fromMap constructor

UHotelRoomResponse.fromMap(
  1. Map<String, dynamic> json
)

Implementation

factory UHotelRoomResponse.fromMap(Map<String, dynamic> json) => UHotelRoomResponse(
  id: json["id"] as String,
  createdAt: DateTime.parse(json["createdAt"]),
  jsonData: UHotelRoomJson.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,
  capacity: json["capacity"] as int,
  pricePerNight: (json["pricePerNight"] as num).toDouble(),
  roomNumber: json["roomNumber"],
  quantity: json["quantity"] == null ? 1 : (json["quantity"] as num).toInt(),
  isAvailable: json["isAvailable"] == null || json["isAvailable"] as bool,
  hotelId: json["hotelId"] as String,
  hotel: json["hotel"] == null ? null : UHotelResponse.fromMap(json["hotel"]),
  reservations: json["reservations"] == null ? <UHotelReservationResponse>[] : List<UHotelReservationResponse>.from(json["reservations"]!.map((dynamic x) => UHotelReservationResponse.fromMap(x))),
  media: json["media"] == null ? <UMediaResponse>[] : List<UMediaResponse>.from(json["media"]!.map((dynamic x) => UMediaResponse.fromMap(x))),
  adminUserIds: json["adminUserIds"] == null ? <String>[] : List<String>.from(json["adminUserIds"]!.map((dynamic x) => x)),
);