// To parse this JSON data, do // // final subscription = subscriptionFromJson(jsonString); import 'dart:convert'; Subscription subscriptionFromJson(String str) => Subscription.fromJson(json.decode(str)); String subscriptionToJson(Subscription data) => json.encode(data.toJson()); class SubscriptionModel { SubscriptionModel({ this.messageStatus, this.totalItemsCount, this.data, this.message, }); int? messageStatus; int? totalItemsCount; List? data; String? message; factory SubscriptionModel.fromJson(Map json) => SubscriptionModel( messageStatus: json["messageStatus"], totalItemsCount: json["totalItemsCount"], data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => Subscription.fromJson(x))), message: json["message"], ); Map toJson() => { "messageStatus": messageStatus, "totalItemsCount": totalItemsCount, "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), "message": message, }; } class Subscription { Subscription({ this.id, this.name, this.description, this.durationName, this.durationDays, this.price, this.currency, this.numberOfBranches, this.numberOfSubUsers, this.numberOfAds, this.countryId, this.countryName, this.isSubscribed, this.subscriptionAppliedId, this.serviceProviderId, this.dateStart, this.dateEnd, this.isExpired, this.isActive, }); int? id; String? name; String? description; String? durationName; int? durationDays; double? price; String? currency; int? numberOfBranches; int? numberOfSubUsers; int? numberOfAds; int? countryId; String? countryName; bool? isSubscribed; int? subscriptionAppliedId; int? serviceProviderId; DateTime? dateStart; DateTime? dateEnd; bool? isExpired; bool? isActive; factory Subscription.fromJson(Map json) => Subscription( id: json["id"], name: json["name"], description: json["description"], durationName: json["durationName"], durationDays: json["durationDays"], price: json["price"]?.toDouble(), currency: json["currency"], numberOfBranches: json["numberOfBranches"], numberOfSubUsers: json["numberOfSubUsers"], numberOfAds: json["numberOfAds"], countryId: json["countryID"], countryName: json["countryName"]!, isSubscribed: json["isSubscribed"], subscriptionAppliedId: json["subscriptionAppliedID"], serviceProviderId: json["serviceProviderID"], dateStart: json["dateStart"] == null ? null : DateTime.parse(json["dateStart"]), dateEnd: json["dateEnd"] == null ? null : DateTime.parse(json["dateEnd"]), isExpired: json["isExpired"], isActive: json["isActive"], ); Map toJson() => { "id": id, "name": name, "description": description, "durationName": durationName, "durationDays": durationDays, "price": price, "currency": currency, "numberOfBranches": numberOfBranches, "numberOfSubUsers": numberOfSubUsers, "numberOfAds": numberOfAds, "countryID": countryId, "countryName": countryName, "isSubscribed": isSubscribed, "subscriptionAppliedID": subscriptionAppliedId, "serviceProviderID": serviceProviderId, "dateStart": dateStart?.toIso8601String(), "dateEnd": dateEnd?.toIso8601String(), "isExpired": isExpired, "isActive": isActive, }; }