productType property

LinkFiveProductType productType

Returns either a LinkFiveProductType.Subscription or LinkFiveProductType.OneTimePurchase for the current product Details

Implementation

LinkFiveProductType get productType {
  if (productDetails is GooglePlayProductDetails) {
    if (googlePlayProductDetails.productDetails.oneTimePurchaseOfferDetails != null) {
      return LinkFiveProductType.OneTimePurchase;
    } else if (googlePlayProductDetails.productDetails.subscriptionOfferDetails != null) {
      return LinkFiveProductType.Subscription;
    }
  }
  if (productDetails is AppStoreProductDetails) {
    if (appStoreProductDetails.skProduct.subscriptionPeriod == null) {
      return LinkFiveProductType.OneTimePurchase;
    } else {
      return LinkFiveProductType.Subscription;
    }
  }
  throw UnsupportedError("Store not supported");
}