class MedicineItem{ int? id; int? companyId; String? name; String? image; String? quantity; String? howWorks; String? directionOfUse; bool? isShowPrescription; dynamic amount; dynamic discount; List? sideEffects; List? uses; MedicineItem.fromJson(Map json){ id = json["id"] ?? 0; companyId = json["companyId"] ?? 0; name = json["name"] ?? ""; image = json["image"] ?? ""; quantity = json["quantity"] ?? ""; howWorks = json["howWorks"] ?? ""; directionOfUse = json["directionOfUse"] ?? ""; amount = json["amount"] ?? 0; discount = json["discount"] ?? 0; isShowPrescription = (json["prescription"] ?? 2) == 1; sideEffects = (json["medicinesideeffects"] != null) ? json["medicinesideeffects"].map((e) => MedicineUses.fromJson(e)).toList() : []; uses = (json["medicineuses"] != null) ? json["medicineuses"].map((e) => MedicineUses.fromJson(e)).toList() : []; } } class MedicineUses{ int? id; String? name; MedicineUses.fromJson(Map json){ id = json["medicineId"] ?? 0; name = json["name"] ?? ""; } }