19 lines
533 B
Dart
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;
|
||
|
}
|
||
|
}
|