class BookingModel { final String uuid, roomName, date, timeSlot; final int cost; BookingModel({ required this.uuid, required this.roomName, required this.date, required this.timeSlot, required this.cost, }); factory BookingModel.zero() => BookingModel( uuid: '', roomName: '', date: '', timeSlot: '', cost: -1, ); factory BookingModel.fromJson(Map json) => BookingModel( uuid: json['uuid'] as String, roomName: json['roomName'] as String, date: json['date'] as String, timeSlot: json['timeSlot'] as String, cost: json['cost'] as int, ); static List fromJsonList(List jsonList) => jsonList .map( (bookModel) => BookingModel.fromJson(bookModel), ) .toList(); Map toJson() => { 'uuid': uuid, 'roomName': roomName, 'date': date, 'timeSlot': timeSlot, 'cost': cost, }; }