AttendanceDetailModel.fromJson constructor

AttendanceDetailModel.fromJson(
  1. Map<String, dynamic> json
)

Creates a new instance of the AttendanceDetailModel class from a JSON map.

The json parameter is a JSON map representing the attendance details. The keys in the JSON map are used to extract the corresponding values.

Implementation

factory AttendanceDetailModel.fromJson(Map<String, dynamic> json) {
  return AttendanceDetailModel(
    id: json['id'] ?? 0,
    date: json['date'],
    clock: json['clock'],
    clockGmt: json['clock_gmt'],
    type: attendanceClockTypeFromString(json['type']) ??
        AttendanceClockType.clockIn,
    image: json['image'] != null
        ? AttendanceImageModel.fromJson(json['image'])
        : null,
    latitude: double.parse('${json['latitude'] ?? 0}'),
    longitude: double.parse('${json['longitude'] ?? 0}'),
    address: json['address'],
    notes: json['notes'],
    scheduleClock: json['schedule_clock'],
    scheduleClockGmt: json['schedule_clock_gmt'],
    isLate: json['is_late'],
    files: json['files'] != null
        ? List<String>.from(json['files']).toList()
        : null,
  );
}