fix: should check for the raw bytes instead of string, in case of a malformed utf8 string
Showing
1 changed file
with
3 additions
and
3 deletions
| @@ -66,7 +66,7 @@ class _MobileScannerState extends State<MobileScanner> | @@ -66,7 +66,7 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | - String? lastScanned; | 69 | + Uint8List? lastScanned; |
| 70 | 70 | ||
| 71 | @override | 71 | @override |
| 72 | Widget build(BuildContext context) { | 72 | Widget build(BuildContext context) { |
| @@ -79,8 +79,8 @@ class _MobileScannerState extends State<MobileScanner> | @@ -79,8 +79,8 @@ class _MobileScannerState extends State<MobileScanner> | ||
| 79 | } else { | 79 | } else { |
| 80 | controller.barcodes.listen((barcode) { | 80 | controller.barcodes.listen((barcode) { |
| 81 | if (!widget.allowDuplicates) { | 81 | if (!widget.allowDuplicates) { |
| 82 | - if (lastScanned != barcode.rawValue) { | ||
| 83 | - lastScanned = barcode.rawValue; | 82 | + if (lastScanned != barcode.rawBytes) { |
| 83 | + lastScanned = barcode.rawBytes; | ||
| 84 | widget.onDetect(barcode, value! as MobileScannerArguments); | 84 | widget.onDetect(barcode, value! as MobileScannerArguments); |
| 85 | } | 85 | } |
| 86 | } else { | 86 | } else { |
-
Please register or login to post a comment