ApphudComposite.fromJson constructor
ApphudComposite.fromJson(
- Map map
Implementation
factory ApphudComposite.fromJson(Map<dynamic, dynamic> map) {
final List<Map<dynamic, dynamic>>? purchasesJson =
(map['nrPurchases'] as List<dynamic>?)?.toMapList;
final List<Map<dynamic, dynamic>>? subscriptionsJson =
(map['subscriptions'] as List<dynamic>?)?.toMapList;
final List<ApphudNonRenewingPurchase> purchases = purchasesJson != null
? purchasesJson
.map((p) => ApphudNonRenewingPurchase.fromJson(p))
.toList()
: List<ApphudNonRenewingPurchase>.of([]);
final List<ApphudSubscriptionWrapper> subscriptions =
subscriptionsJson != null
? subscriptionsJson
.map((s) => ApphudSubscriptionWrapper.fromJson(s))
.toList()
: List<ApphudSubscriptionWrapper>.of([]);
return ApphudComposite(
purchases: purchases,
subscriptions: subscriptions,
error: map['error'] != null ? ApphudError.fromJson(map['error']) : null,
);
}