Product.fromMap constructor
Implementation
factory Product.fromMap(Map<String, dynamic> map) {
return Product(
id: map['id'] as String,
displayName: map['displayName'] as String,
productDescription: map['productDescription'] as String,
type: ZSProductType.fromRawValue(map['type'] as String),
webPrice: map['webPrice'] != null
? Price.fromMap(Map<String, dynamic>.from(map['webPrice'] as Map))
: null,
appStorePrice: map['appStorePrice'] != null
? Price.fromMap(Map<String, dynamic>.from(map['appStorePrice'] as Map))
: null,
syncedToAppStoreConnect: map['syncedToAppStoreConnect'] as bool? ?? false,
subscriptionGroupId: map['subscriptionGroupId'] as int?,
promotion: map['promotion'] != null
? Promotion.fromMap(Map<String, dynamic>.from(map['promotion'] as Map))
: null,
storeKitAvailable: map['storeKitAvailable'] as bool? ?? false,
storeKitPrice: map['storeKitPrice'] != null
? Price.fromMap(Map<String, dynamic>.from(map['storeKitPrice'] as Map))
: null,
savingsPercent: map['savingsPercent'] as int?,
billingInterval: map['billingInterval'] as String?,
freeTrialDuration: map['freeTrialDuration'] as String?,
isTrialEligible: map['isTrialEligible'] as bool?,
);
}