remove multiple foundcode calls

This commit is contained in:
2025-03-05 13:49:31 +02:00
parent 05aabec4ad
commit 887881bb84

View File

@@ -23,10 +23,15 @@ class _MihBarcodeScannerState extends State<MihBarcodeScanner>
);
StreamSubscription<Object>? _subscription;
bool _isScannerStarting = false;
bool barcodeScanned = false;
void foundCode(BarcodeCapture bcode) {
if (bcode.barcodes.isNotEmpty && bcode.barcodes.first.rawValue != null) {
if (mounted &&
barcodeScanned == false &&
bcode.barcodes.isNotEmpty &&
bcode.barcodes.first.rawValue != null) {
setState(() {
barcodeScanned = true;
widget.cardNumberController.text = bcode.barcodes.first.rawValue!;
});
print(bcode.barcodes.first.rawValue);