Transaction.fromMap constructor

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

Implementation

factory Transaction.fromMap(Map<String, dynamic> map) {
  return Transaction(
    id: map['id'] as String?,
    productID: map['productID'] as String?,
    productType: ProductTypeConverter.fromString(
      map['productType'] as String?,
    ),
    ownershipType: OwnershipTypeConverter.fromString(
      map['ownershipType'] as String?,
    ),
    price: map['price'] as double?,
    currency: map['currency'] as String?,
    originalID: map['originalID'] as String?,
    originalPurchaseDate: map['originalPurchaseDate'] as int?,
    purchaseDate: map['purchaseDate'] as int?,
    purchasedQuantity: map['purchasedQuantity'] as int?,
    purchaseReason: PurchaseReasonConverter.fromString(
      map['purchaseReason'] as String?,
    ),
    subscriptionGroupID: map['subscriptionGroupID'] as String?,
    expirationDate: map['expirationDate'] as int?,
    isUpgraded: map['isUpgraded'] as bool?,
    hasRevocation: map['hasRevocation'] as bool?,
    revocationDate: map['revocationDate'] as int?,
    revocationReason: map['revocationReason'] as int?,
    environment: map['environment'] as String?,
    appAccountToken: map['appAccountToken'] as String?,
    appBundleID: map['appBundleID'] as String?,
    appTransactionID: map['appTransactionID'] as String?,
    signedDate: map['signedDate'] as int?,
    storefrontId: map['storefrontId'] as String?,
    storefrontCountryCode: map['storefrontCountryCode'] as String?,
    storefrontCurrency: map['storefrontCurrency'] as String?,
    webOrderLineItemID: map['webOrderLineItemID'] as String?,
    deviceVerificationNonce: map['deviceVerificationNonce'] as String?,
    deviceVerification: map['deviceVerification'] as String?,
    offer: map['offer'] != null
        ? TransactionOffer.fromMap(map['offer'] as Map<String, dynamic>)
        : null,
    isSubscribedButFreeTrailCancelled:
        map['isSubscribedButFreeTrailCancelled'] == true,
  );
}