PurchaseProduct class

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.

expiredPeriod allows you to specify the duration of the subscription for testing.

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

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

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

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

expiredPeriodを指定するとテスト用のサブスクリプションの期間を指定することができます。

Annotations

Constructors

PurchaseProduct({required String productId, required PurchaseProductType type, required double price, double? amount, String title = "", String description = "", Widget? icon, Duration? expiredPeriod, PurchaseSubscriptionPeriod? subscriptionPeriod = PurchaseSubscriptionPeriod.none, String? priceText, bool debugConsumeWhenPurchaseCompleted = false, bool debugForcePurchased = false, List<String> offerIds = const [], Widget priceBuilder(BuildContext context, PurchaseProduct product)?})
Define chargeable items.
const
PurchaseProduct.subscription({required String productId, required double price, required Duration expiredPeriod, String title = "", String description = "", Widget? icon, String? priceText, PurchaseSubscriptionPeriod? subscriptionPeriod = PurchaseSubscriptionPeriod.month, bool debugForcePurchased = false, Widget priceBuilder(BuildContext context, PurchaseProduct product)?, List<String> offerIds = const []})
Define chargeable items.
const
PurchaseProduct.unlock({required String productId, required double price, String title = "", String description = "", Widget? icon, String? priceText, bool debugConsumeWhenPurchaseCompleted = false, bool debugForcePurchased = false, Widget priceBuilder(BuildContext context, PurchaseProduct product)?, List<String> offerIds = const []})
Define chargeable items.
const
PurchaseProduct.wallet({required String productId, required double amount, required double price, String title = "", String description = "", Widget? icon, String? priceText, bool debugForcePurchased = false, Widget priceBuilder(BuildContext context, PurchaseProduct product)?, List<String> offerIds = const []})
Define chargeable items.
const

Properties

amount double?
The amount of wallet money (gems) you add when you purchase a charged item.
final
availableSpecialOffer bool
Whether the special offer is available.
no setter
basicProduct PurchaseProduct?
Basic product.
no setter
debugConsumeWhenPurchaseCompleted bool
If type is PurchaseProductType.nonConsumable, returns true if the product is automatically consumed when the purchase is completed.
no setter
debugForcePurchased bool
Force purchased.
final
description String
Description of the charged items (as set up).
no setter
descriptionOnStore String
Description of the charged items (tentative).
no setter
expiredPeriod Duration?
Period of validity.
final
hashCode int
The hash code for this object.
no setteroverride
icon Widget?
Icons of charged items.
final
offerIds List<String>
List of offer IDs.
final
price double
Price of items charged (tentative).
final
priceBuilder Widget Function(BuildContext context, PurchaseProduct product)?
Builder of the price display section.
final
priceText String
Text with the currency mark of the item charged.
no setter
productId String
Product ID.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subProducts List<PurchaseProduct>
List of sub-billed items included in this billed item.
no setter
subscriptionPeriod PurchaseSubscriptionPeriod?
Subscription expiration period.
final
title String
Title of the charged item (as set up).
no setter
titleOnStore String
Title of the charged item (as loaded from the store).
no setter
type PurchaseProductType
Type of item charged.
final
value PurchaseProductValue?
After executing load, if the load is successful, the actual data can be obtained from here.
no setter

Methods

load() Future<void>
Load real data from the database.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reload() Future<void>
Reloads real data from the database. Execute when you want to update data that has already been loaded.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override