Skip to content

Commit

Permalink
Ignore invalid barcodes (#6108)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k authored Jan 4, 2025
1 parent eb01310 commit 87b51cc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ class ContinuousScanModel with ChangeNotifier {
}

code = _fixBarcodeIfNecessary(code);
if (code.length < 4) {
return false;
}

if (_latestScannedBarcode == code || _barcodes.contains(code)) {
lastConsultedBarcode = code;
Expand Down Expand Up @@ -295,7 +298,7 @@ class ContinuousScanModel with ChangeNotifier {
/// Sometimes the scanner may fail, this is a simple fix for now
/// But could be improved in the future
String _fixBarcodeIfNecessary(String code) {
code = code.replaceAll('-', '');
code = code.replaceAll('-', '').trim();

if (code.length == 12) {
return '0$code';
Expand Down

0 comments on commit 87b51cc

Please sign in to comment.