juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
811 stars 475 forks source link

Scan barcode result with parenthesis #817

Open 70r63x opened 10 months ago

70r63x commented 10 months ago

Hello,

I have a barcode with code that has parenthesis like the image I attach. When I sacan the barcode the widget works very fine but the result is a string without parenthesis and I need the code with that.

How can i get the code with all parameters that the image has?

Thanks

This is the barcode

Captura de pantalla 2023-10-23 a la(s) 10 25 30 a m

This is the result I have with the widget MobileScanner 41570828031120228020123453900100

The result I spect (415)7082803112022(8020)12345(3900)100

navaronbracke commented 10 months ago

Unfortunately, when I scan this code I get:

format: BarcodeFormat.code128
type: BarcodeType.text
rawValue: "]C141570828031120228020123453900100"
displayValue: "41570828031120228020123453900100"

and decoding the bytes with utf8.decode I also get no different result.

I think this is a limitation of MLKit.

The plugin currently uses com.google.mlkit:barcode-scanning:17.2.0, but there are newer versions of MLKit available.

Does any of the newer MLKit versions detect the code properly? If so then we can try to bump the used version of MLKIt.

70r63x commented 10 months ago

Hi @navaronbracke

thanks for the response

I tried to use flutter_zxing plugin and this work with parenthesis but only works for Android and I need it for both (Android IOS).

with your plugin works very fine in both device but i need this parenthesis in te scan result.

Maybe if you try to upgrade the version of MLKit can works.

thanks

70r63x commented 10 months ago

Hello @navaronbracke,

Any news regarding this?

thank you

navaronbracke commented 10 months ago

I am planning on upgrading the MLKit version for Android to the latest available version today.

This hopefully addresses this issue and #836

navaronbracke commented 10 months ago

@70r63x So the code above is a Code-128. Its raw value includes ]C1 in the very beginning.

Do you need to only scan Code-128, with the "(" and ")" in the same spot? Or are there other Code-128 codes that do not have this value? If you have the three-character prefix of ]C1 in your raw value, perhaps you could manually insert the ( and ) ?

Just thinking out loud for a workaround.

navaronbracke commented 10 months ago

@70r63x Unfortunately version 18.3.0 of the Android MLKit library does not fix this. There are no newer versions available at the moment. iOS is also up-to-date.