validateScanning method
dynamic
validateScanning()
Implementation
validateScanning() {
if (selectedScanType.value == "Single") {
String iccid = singleScanController.text;
if (iccid.isEmpty) {
Helper.assetSuccessDialog(
Get.context!,
"Failed to add asset.",
"Serial number cannot be empty",
const AssetImage(
"assets/images/failed.png",
));
return;
}
callScanApi(singleScanController.text, null, null, "1234");
} else if (selectedScanType.value == "Range") {
String start = rangeStartScanController.value.text;
String end = rangeEndScanController.value.text;
if (start.isEmpty || end.isEmpty) {
Helper.assetSuccessDialog(
Get.context!,
"Failed to add asset.",
"Please enter start and end range",
const AssetImage(
"assets/images/failed.png",
));
return;
}
rangeStartScanController.value.clear();
rangeEndScanController.value.clear();
if (int.parse(start) > int.parse(end)) {
Helper.assetSuccessDialog(
Get.context!,
"Failed to add asset.",
"End range must be greater than start range",
const AssetImage(
"assets/images/failed.png",
));
return;
}
callScanApi(null, start, end, "1234");
}
}