checkEventPurchase method

Future<bool> checkEventPurchase(
  1. String objectID
)

Implementation

Future<bool> checkEventPurchase(String objectID) async {
  String purchaseListData =
      await getPurchaseList(fetchPurchaseFromLocal: true);
  if (purchaseListData == "") {
    return false;
  }
  var purchaseModel = PurchaseModel.fromJson(purchaseListData);
  //the response contains a purchase list, parse it and check if the objectid exists
  var purchaseList = purchaseModel.data;
  for (var i = 0; i < purchaseList!.length; i++) {
    var purchaseItem = purchaseList[i];
    if (purchaseItem.objectid == objectID) {
      return true;
    }
  }
  return false;
}