class AttendanceModel { final int id; final String name; final String projectAddress; final String contactPerson; final DateTime startDate; final DateTime endDate; final int teamSize; final int completedWork; final int plannedWork; AttendanceModel({ required this.id, required this.name, required this.projectAddress, required this.contactPerson, required this.startDate, required this.endDate, required this.teamSize, required this.completedWork, required this.plannedWork, }); factory AttendanceModel.fromJson(Map json) { return AttendanceModel( id: int.tryParse(json['id'].toString()) ?? 0, name: json['name'] ?? '', projectAddress: json['projectAddress'] ?? '', contactPerson: json['contactPerson'] ?? '', startDate: DateTime.tryParse(json['startDate'].toString()) ?? DateTime.now(), endDate: DateTime.tryParse(json['endDate'].toString()) ?? DateTime.now(), teamSize: int.tryParse(json['teamSize'].toString()) ?? 0, completedWork: int.tryParse(json['completedWork'].toString()) ?? 0, plannedWork: int.tryParse(json['plannedWork'].toString()) ?? 0, ); } }