initInAppPurchase method
Implementation
void initInAppPurchase(OnRechargePluginDelegate delegate) {
try {
this.delegate = delegate;
Stream purchaseUpdated = connection.purchaseStream;
subscription = purchaseUpdated.listen((purchaseDetailsList) {
listenToPurchaseUpdated(purchaseDetailsList);
}, onDone: () {
subscription.cancel();
AppConfig.printLog('subscription: cancel');
}, onError: (error) {
AppConfig.printLog('purchaseUpdated: $error');
}) as StreamSubscription<List<PurchaseDetails>>;
queryPastPurchases(first: true);
if (Platform.isIOS) {
var iosPlatformAddition = connection
.getPlatformAddition<InAppPurchaseStoreKitPlatformAddition>();
iosPlatformAddition.setDelegate(ExamplePaymentQueueDelegate());
}
} catch (e) {
AppConfig.printLog(e);
}
}