ZSProduct.fromMap constructor

ZSProduct.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory ZSProduct.fromMap(Map<String, dynamic> map) {
  return ZSProduct(
    id: map['id'] as String,
    displayName: map['displayName'] as String,
    productDescription: map['productDescription'] as String,
    type: ZSProductType.fromRawValue(map['type'] as String),
    webPrice: Price.fromMap(Map<String, dynamic>.from(map['webPrice'] as Map)),
    appStorePrice: map['appStorePrice'] != null
        ? Price.fromMap(Map<String, dynamic>.from(map['appStorePrice'] as Map))
        : null,
    syncedToASC: map['syncedToASC'] as bool? ?? false,
    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?,
  );
}