import 'package:intl/intl.dart'; import 'package:medcify/helpers.dart'; import 'package:medcify/models/plan_item.dart'; class PlanResponse{ List? plans; String? expiryDate; String? error; String? currentPlan; bool? status; bool? planStatus; PlanResponse.fromJson(Map json){ plans = (json["PlanList"] != null) ? json["PlanList"].map((e) => PlanItem.fromJson(e)).toList() : []; status = json["Status"] ?? false; currentPlan = json["CurrentPlan"] ?? ""; planStatus = json["PlanStatus"] ?? false; var date = json["ExpiryOn"] ?? ""; expiryDate = (date != "") ? DateFormat().add_yMMMd().format(DateTime.parse(date)) : ""; } PlanResponse.withError(String err){ error = err; } }