Application/medcify/lib/models/api/medicine_response.dart
2022-09-26 12:03:52 +05:30

19 lines
533 B
Dart

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