initIap method
Implementation
Future<void> initIap(Set<String> ids) async {
setIds(ids);
// sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences?.getBool("premiumUser") ?? false) {
setPremiumUser(true);
GlobalAdVariables.isPremiumUser = true;
}
subscription = purchaseUpdated.listen((purchaseDetailsList) {
listenToPurchaseUpdated(purchaseDetailsList);
}, onDone: () {
subscription?.cancel();
}, onError: (error) {
// handle error here.
});
await fetchStoreProducts();
InAppPurchase.instance.restorePurchases(applicationUserName: DeviceMethods().deviceId);
}