'Every products listen PurchaseStatus.purchased working

I already purchased but every listened products and premium page opened PurchasedStatus.purchased working.

void listenToPurchaseUpdated(List<PurchaseDetails> purchaseDetailsList, BuildContext context) {
  purchaseDetailsList.forEach((PurchaseDetails purchaseDetails) async {
    debugPrint('special forEach ${purchaseDetails.productID}');
    switch (purchaseDetails.status) {
      case PurchaseStatus.pending:
        await getCircularCupertinoAlert(context: context);
        break;
      case PurchaseStatus.purchased:
        await inAppSuccessHandler(purchaseDetails: purchaseDetails, context: context); //todo init add
        break;
      case PurchaseStatus.restored:
        await inAppRestoreHandler(purchaseDetails: purchaseDetails, context: context); //todo init add
        break;
      case PurchaseStatus.error:
        await InAppPurchase.instance.completePurchase(purchaseDetails);
        await inAppErrorHandler(purchaseDetails: purchaseDetails, context: context);
        break;
      default:
        break;
    }
    if (purchaseDetails.pendingCompletePurchase) {
      await InAppPurchase.instance.completePurchase(purchaseDetails);
    }
  });
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source