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

25 lines
758 B
Dart
Raw Normal View History

2022-09-26 06:33:52 +00:00
import 'package:intl/intl.dart';
import 'package:medcify/helpers.dart';
import 'package:medcify/models/plan_item.dart';
class PlanResponse{
List<PlanItem>? plans;
String? expiryDate;
String? error;
String? currentPlan;
bool? status;
bool? planStatus;
PlanResponse.fromJson(Map<String, dynamic> json){
plans = (json["PlanList"] != null) ? json["PlanList"].map<PlanItem>((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;
}
}