PurchaseProduct.wallet constructor

const PurchaseProduct.wallet({
  1. required String productId,
  2. required double amount,
  3. required double price,
  4. String title = "",
  5. String description = "",
  6. Widget? icon,
  7. String? priceText,
  8. bool debugForcePurchased = false,
  9. Widget priceBuilder(
    1. BuildContext context,
    2. PurchaseProduct product
    )?,
  10. List<String> offerIds = const [],
})

Define chargeable items.

PurchaseProduct.wallet] to create a wallet type billing item, PurchaseProduct.unlock to create a feature unlock type billing item, PurchaseProduct.subscription to Create a subscription with PurchaseProduct.subscription.

Be sure to match productId with the store's ID.

price is overwritten when a charged item is loaded from the store. title and description can be retrieved from titleOnStore and descriptionOnStore loaded from the store.

課金アイテムの定義を行います。

PurchaseProduct.walletでウォレットタイプの課金アイテムを作成し、PurchaseProduct.unlockで機能アンロックタイプの課金アイテムを作成、PurchaseProduct.subscriptionでサブスクリプションを作成します。

productIdをストア側のIDと必ず合わせるようにしてください。

priceは課金アイテムをストアからロードした際に上書きされます。titledescriptiontitleOnStoredescriptionOnStoreでストアからロードしたものを取得できます。

Implementation

const PurchaseProduct.wallet({
  required this.productId,
  required double amount,
  required this.price,
  String title = "",
  String description = "",
  this.icon,
  String? priceText,
  this.debugForcePurchased = false,
  this.priceBuilder,
  this.offerIds = const [],
})  : type = PurchaseProductType.consumable,
      subscriptionPeriod = PurchaseSubscriptionPeriod.none,
      expiredPeriod = null,
      _priceText = priceText,
      amount = amount,
      _title = title,
      _description = description,
      _debugConsumeWhenPurchaseCompleted = false;