shaxxx / flutter_barcode_listener

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

Get empty after scan in windows #12

Closed TungWang closed 2 years ago

TungWang commented 2 years ago

Hi! Thank you for create this plugin. I got an empty string after scan barcode. Is there any way to solve this problem?

VAbbas commented 2 years ago

got empty string after scan in windows

danielroek commented 2 years ago

It seems that in some cases Windows uses RawKeyDownEvent instead of the implementation's RawKeyUpEvent. I've created a PR, #14 , in which it is possible to set the use of RawKeyDownEvent by setting the useKeyDownEvent to true. Keep in mind that using this on non-Windows systems might result in issues. A possible way to overcome this would be to use Platform.isWindows if you are supporting multiple operating systems.

Would you be able to see if the PR I created works as intended? You can test this by changing the dependency in pubspec.yaml to:

  flutter_barcode_listener:
    git:
      url: https://github.com/danielroek/flutter_barcode_listener.git
      ref: feature/key_down_event
tosyak commented 2 years ago

Hi! Want to thank you for your package! I also got this problem in windows and i've tried to use your dependency from git, but they also did not work. So i took your package and replaced method and used it localy. This way that worked!

danielroek commented 2 years ago

Hey @tosyak ,

Could you provide the method you changed to make it work? That way we'd be able to improve this package.

shaxxx commented 2 years ago

I'm working on this at this moment

shaxxx commented 2 years ago

Hopefully fixed in 0.1.3 Please reopen issue if you're still having problems.