shaxxx / flutter_barcode_listener

Flutter widget to listen for scanned barcode via hardware scanners
MIT License
45 stars 46 forks source link

android scanning code128 barcode decodes to something different #34

Open Florianvdab opened 1 year ago

Florianvdab commented 1 year ago

Hi guys, I'm liking the package so far but I'm struggling with something. While using a CS6080 scanner as an HID keyboard via BT, I'm scanning a CODE128 barcode:

image

The barcode should decode to: 3BE9604F-9E76-42F8-A584-288AD1B7D087

When I scan this barcode on a notes app on both android and iOS it scans the whole barcode correct, so the scanner is working as expected. But on my flutter android app it decodes to: #Be960$f-(e76-4@f8_a584-28*Ad!b&d087 I've tried debugging the package a little and it looks like it might be because of a shift key or something like that. On iOS however it seems to be working perfectly.

Can you guys possibly help me out? Feel free to reach out so I can help further.

anthonycuervo23 commented 1 year ago

I am having the same issue, did you find a solution ?

Florianvdab commented 1 year ago

No, the problem seemed to be in the way keys are pressed on the different OS. From what I can remember shift keys were the problem. I didn't have the time to figure out a solution for this issue, I guess the best thing you can do is make sure barcodes are simple...

anthonycuervo23 commented 1 year ago

No, the problem seemed to be in the way keys are pressed on the different OS. From what I can remember shift keys were the problem. I didn't have the time to figure out a solution for this issue, I guess the best thing you can do is make sure barcodes are simple...

With shift keys you mean to avoid sending any symbols like -{,:"}@ ?

Florianvdab commented 1 year ago

No, my scanner was acting like a keyboard. A capital letter a would be Shift + a . That would give me issue, you can always log or debug the package to learn what exactly happens to the barcode that you scan.

m-pastuszek commented 10 months ago

I have same issue. Outside the app, the barcode is recognized correctly. Just using this package I get incorrect decodings. For example, barcode 4000_TRA_TRAILER01 decodes as 400)_TRA_TRAILEr01. Any ideas?

Okay, It looks like shift issue... But is there a way to solve this without changing barcode data?

MongkolJ commented 10 months ago

I have had the same problem. Enable flag useKeyDownEvent did work for me.

BarcodeKeyboardListener(
    useKeyDownEvent: true,
    bufferDuration: const Duration(milliseconds: 2500),
    onBarcodeScanned: (barcode) async {},
)