import 'dart:convert'; import 'booking_time.dart'; class BookingDateTime { String viewDate; int unixTime; String sendTimeTip; List bookTimes; BookingDateTime(this.viewDate, this.unixTime, this.sendTimeTip, this.bookTimes); BookingDateTime.fromJson(Map json) : viewDate = json['view_date'], unixTime = int.parse(json['unix_time'].toString()), sendTimeTip = json['send_time_tip'], bookTimes = (json['book_times'] as List).map((e) => BookingTime.fromJson(e)).toList(); Map toJson() => { 'view_date': viewDate, 'unix_time': unixTime, 'send_time_tip': sendTimeTip, 'book_times': bookTimes, }; @override String toString() { return json.encode(this); } }