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