ScheduleModel.fromJson constructor
Creates a new instance of the ScheduleModel class from a JSON map.
The json
parameter is a JSON map representing the schedule details.
The keys in the JSON map are used to extract the corresponding values.
Implementation
factory ScheduleModel.fromJson(Map<String, dynamic> json) => ScheduleModel(
id: json["id"],
date: DateTime.parse(json["date"]).toLocal(),
isLeave: json["is_leave"],
timeStart: json['shift'] != null ? json['shift']['time_start'] : null,
timeEnd: json['shift'] != null ? json['shift']['time_end'] : null,
name: json['shift'] != null ? json['shift']['name'] : null,
);