// To parse this JSON data, do // // final schedule = scheduleFromJson(jsonString); import 'dart:convert'; Schedule scheduleFromJson(String str) => Schedule.fromJson(json.decode(str)); String scheduleToJson(Schedule data) => json.encode(data.toJson()); class Schedule { final int? messageStatus; final int? totalItemsCount; final List? data; final String? message; Schedule({ this.messageStatus, this.totalItemsCount, this.data, this.message, }); factory Schedule.fromJson(Map json) => Schedule( messageStatus: json["messageStatus"], totalItemsCount: json["totalItemsCount"], data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => ScheduleData.fromJson(x))), message: json["message"], ); Map toJson() => { "messageStatus": messageStatus, "totalItemsCount": totalItemsCount, "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), "message": message, }; } class ScheduleData { final int? id; final int? branchId; final DateTime? fromDate; final DateTime? toDate; final String? startTime; final String? endTime; final int? slotDurationMinute; final int? perSlotAppointment; ScheduleData({ this.id, this.branchId, this.fromDate, this.toDate, this.startTime, this.endTime, this.slotDurationMinute, this.perSlotAppointment, }); factory ScheduleData.fromJson(Map json) => ScheduleData( id: json["id"], branchId: json["branchID"], fromDate: json["fromDate"] == null ? null : DateTime.parse(json["fromDate"]), toDate: json["toDate"] == null ? null : DateTime.parse(json["toDate"]), startTime: json["startTime"], endTime: json["endTime"], slotDurationMinute: json["slotDurationMinute"], perSlotAppointment: json["perSlotAppointment"], ); Map toJson() => { "id": id, "branchID": branchId, "fromDate": fromDate?.toIso8601String(), "toDate": toDate?.toIso8601String(), "startTime": startTime, "endTime": endTime, "slotDurationMinute": slotDurationMinute, "perSlotAppointment": perSlotAppointment, }; }