Closed gunnerxd6 closed 2 years ago
What do you mean by "result is inconsistent"? Does it work at all? Does it work when you try to scan in some tex editor? Does it work only sometimes? Does it always work but result is not always correct? What have you tried so far? Please provide more details.
I have nearly a similar problem. We are using a Honeywell CT60 with an internal scanner. This one we us with Wedge Method "Keyboard". The Problem is, that the digits aren't RawKeyUpEvents (they are KeyDownEvents), which are needed. So just the "Enter" Button is fired an the returned barcode is empty.
In the other issues I saw that this was edited for a year. One solution could be to make it optional.
I set the scanner in Keyboard mode and it worked
The Problem is, that the digits aren't RawKeyUpEvents (they are KeyDownEvents), which are needed.
This is something to think about for sure. Don't remember it now, but there was some problems with KeyDown implementation. If I have some time on my hands I'll try to make this optional. PRs are welcome of course.
@shaxxx Would it be a solution to give the BarcodeKeyboardListener
an option to switch between KeyUpEvent
and KeyDownEvent
That might look something like:
BarcodeKeyboardListener(
keyEventType: KeyboardListenerEventType.keyUpEvent //This would be an enum indicating which event to listen to.
onBarcodeScanned: (code) {
//TODO: Handle code
}
That was my idea. If I remember correctly there are some differences between handling KeyUp & KeyDown that need to be taken in consideration. You can take a look at the commit history and see if something sticks out.
Any solution on this? I am getting empty barcode in Windows. On MacOS its working perfectly.
@utpalruparel I wasn't able to test this om Windows, as I run Fedora on my laptop. Didn't have the time to install a VM for this issue. However, I believe I found the source of the problem. This line
_controller.sink
.add(((keyEvent.data) as RawKeyEventDataWindows).keyLabel);
should be changed to:
_controller.sink.add(String.fromCharCode(
((keyEvent.data) as RawKeyEventDataWindows).characterCodePoint));
I've created a PR #9 could you please verify if this works for your implementation? You can do this by changing the dependency to:
flutter_barcode_listener:
git:
url: https://github.com/danielroek/flutter_barcode_listener.git
ref: fix/windows_charPoint
Thank you for the quick reply. I just tried with this dependency but not worked.
Actually now I am not getting blank barcode but getting blank spaces (same as string length of barcode)
worked on windows after change
RawKeyUpEvent > RawKeyDownEvent
This solution is working for me too. if (keyEvent is RawKeyDownEvent)
I have a problem with this library, since although it manages to capture the barcodes, most of the attempts, the onBarcodeScanned function returns me an empty barcode, I have tried different EAN 13 barcodes but the result is inconsistent. I also tried to change the bufferDuration property but it doesn't seem to work either. I'm working on a NQ1000-II android tablet with integrated barcode scanner.