registerPlatform static method
void
registerPlatform()
Registers this class as the default instance of InAppPurchasePlatform
.
Implementation
static void registerPlatform() {
// Register the [InAppPurchaseStoreKitPlatformAddition] containing
// StoreKit-specific functionality.
InAppPurchasePlatformAddition.instance =
InAppPurchaseStoreKitPlatformAddition();
// Register the platform-specific implementation of the idiomatic
// InAppPurchase API.
InAppPurchasePlatform.instance = InAppPurchaseStoreKitPlatform();
_skPaymentQueueWrapper = SKPaymentQueueWrapper();
// Create a purchaseUpdatedController and notify the native side when to
// start of stop sending updates.
final StreamController<List<PurchaseDetails>> updateController =
StreamController<List<PurchaseDetails>>.broadcast(
onListen: () => _skPaymentQueueWrapper.startObservingTransactionQueue(),
onCancel: () => _skPaymentQueueWrapper.stopObservingTransactionQueue(),
);
_observer = _TransactionObserver(updateController);
_skPaymentQueueWrapper.setTransactionObserver(observer);
}