Application/medcify/lib/models/api/pincode_response.dart

19 lines
523 B
Dart
Raw Normal View History

2022-09-26 06:33:52 +00:00
import 'package:medcify/models/pincode_item.dart';
class PincodeResponse{
bool? status;
String? message;
List<PincodeItem>? pincodes;
PincodeResponse.fromJson(Map<String, dynamic> json){
status = (json["Code"] ?? "0") != "0";
pincodes = (json["Data"] != null) ? json["Data"].map<PincodeItem>((e) => PincodeItem.fromJson(e)).toList() : [];
message = json["Message"] ?? "Something went wrong";
}
PincodeResponse.withError(String err){
status = false;
pincodes = [];
message = err;
}
}