25 lines
758 B
Dart
25 lines
758 B
Dart
|
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;
|
||
|
}
|
||
|
}
|