deleteBoxId method
Implementation
Future<void> deleteBoxId({
String? boxId,
bool isBox = false,
}) async {
try {
ProductContentModel? scannedProduct;
scannedProduct = currentProduct;
var range = scannedProduct.rangeList!
.firstWhere((element) => element.boxRangeId == boxId);
var iccidList = range.iccidList;
iccidList!.forEach((element) {
scannedProduct!.scannedserialNums!
.removeWhere((data) => element.iccid == data.toString());
scannedIccidList
.removeWhere((data) => element.iccid == data.toString());
});
scannedProduct.rangeList!
.removeWhere((element) => element.boxRangeId == boxId);
ProductContentModel updatedProduct = scannedProduct.copyWith(
rangeList: scannedProduct.rangeList,
scannedQty: scannedProduct.scannedserialNums!.length,
scannedserialNums: scannedProduct.scannedserialNums);
var temp = productDataScannedList;
int index = temp.indexOf(scannedProduct);
temp[index] = updatedProduct;
productDataScannedList = temp;
} catch (error) {
ConditionalLogs().customLog("$error");
}
}