import 'package:medcify/models/medicine_item.dart'; class MedicineResponse{ bool? status; String? message; List? medicines; MedicineResponse.fromJson(Map json){ status = (json["Code"] ?? "0") != "0"; medicines = (json["Data"] != null) ? json["Data"].map((e) => MedicineItem.fromJson(e)).toList() : []; message = json["Message"] ?? "Something went wrong"; } MedicineResponse.withError(String err){ status = false; medicines = []; message = err; } }