class UserProfileDto { num id; String name; String email; String avatar; String ageRange; List foodAllergiesList; List dietaryPreferencesList; List medicalInformationList; List currentMedicationsList; String activityLevel; int? qStatus; UserProfileDto({ this.id = 0, this.name = "", this.email = "", this.avatar = "", this.ageRange = "", List? foodAllergiesList, List? dietaryPreferencesList, List? medicalInformationList, List? currentMedicationsList, this.qStatus, this.activityLevel = "", }) : foodAllergiesList = foodAllergiesList ?? [], dietaryPreferencesList = dietaryPreferencesList ?? [], medicalInformationList = medicalInformationList ?? [], currentMedicationsList = currentMedicationsList ?? []; Map toJson() { return { "id": id, "name": name, "email": email, "avatar": avatar, "age_range": ageRange, "food_allergies": foodAllergiesList, "dietary_preferences": dietaryPreferencesList, "medical_information": medicalInformationList, "current_medications": currentMedicationsList, "activity_level": activityLevel, "q_status": qStatus, }; } factory UserProfileDto.fromJson(Map json) { return UserProfileDto( id: json["id"] ?? 0, name: json["name"] ?? "", email: json["email"] ?? "", avatar: json["avatar"] ?? "", ageRange: json["age_range"] ?? "", foodAllergiesList: (json["food_allergies"] as List?)?.cast() ?? [], dietaryPreferencesList: (json["dietary_preferences"] as List?)?.cast() ?? [], medicalInformationList: (json["medical_information"] as List?)?.cast() ?? [], currentMedicationsList: (json["current_medications"] as List?)?.cast() ?? [], activityLevel: json["activity_level"] ?? "", qStatus: json["q_status"], ); } }