deleteProductGrn method

dynamic deleteProductGrn(
  1. String productCode
)

Implementation

deleteProductGrn(String productCode) {
  var tempIccids = <String>[].obs;
  tempIccids.addAll(scannedIccidList);
  RxList<ProductContentModel> temp = <ProductContentModel>[].obs;
  temp.addAll(productDataScannedList);
  for (int i = 0; i < productDataScannedList.length; i++) {
    if (productDataScannedList[i].productCode == productCode) {
      productDataScannedList[i].iccidList!.forEach((element) {
        tempIccids.remove(element.iccid);
      });
      var grnProduct = temp[i].copyWith(iccidList: [], scannedQty: 0);
      temp[i] = grnProduct;
    }
  }
  scannedIccidList = tempIccids;
  productDataScannedList.value = [...temp];
}