flutter_barcode_listener icon indicating copy to clipboard operation
flutter_barcode_listener copied to clipboard

Email string @ symbol is returned as "2"

Open blackbeario opened this issue 3 years ago • 1 comments

Hey, thanks for this package! I'm scanning 2D barcodes in a variety of formats, QR Codes and Data Matrix (doesn't seem to work in my tests with Aztec format but that's another issue).

I'm generating 2D barcodes with name, age, and email strings. While on the Flutter stable channel, the results were returned wrong nearly every time. But after switching to the Flutter Beta channel the results are correct except for the email string. Specifically the @ symbol is returned as "2".

If I add a barcode with the email [email protected], the plugin returns me2gmail.com every time. I don't know much about this plugin yet, but will see if I can figure it out.

For reference, I'm using a Netum NSL5S USB scanner on a Mac. The scanner works perfectly every time while in a text editing application.

Flutter (Channel beta, 2.9.0-0.1.pre, on macOS 11.2 20D64 darwin-x64, locale en-US)

blackbeario avatar Dec 23 '21 00:12 blackbeario

Hey @blackbeario,

In the plugin this is the line that handles the MacOS keyEvent:

...
      } else if (keyEvent.data is RawKeyEventDataMacOs) {
        _controller.sink
            .add(((keyEvent.data) as RawKeyEventDataMacOs).keyLabel);
      }

The problem here is that we listen to the keyLabel, which is '2'. I've created a PR(#13) that listens to character instead. I don't have access to a MacOs device any time soon, would you be able to test if this works?

You'd be able to test this by changing the dependency in pubspec.yaml to:

  flutter_barcode_listener:
    git:
      url: https://github.com/danielroek/flutter_barcode_listener.git
      ref: mac_os_characters

danielroek avatar Jan 26 '22 13:01 danielroek

This is merged. Closing.

shaxxx avatar Nov 11 '22 07:11 shaxxx