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
876 stars 508 forks source link

BarcodeType.Product does not have a value class associated with it #1044

Open hhzhangzy opened 6 months ago

hhzhangzy commented 6 months ago

Hi,plugin 4.0.1 version provided declaration of 'Product': 屏幕截图 2024-04-26 183837

but,the 'barcode.dart' file not get method of product value. Is there an indirect way to obtain it?

navaronbracke commented 6 months ago

Can you clarify what you mean? Is BarcodeType.product never reported for barcodes that have the product type?

hhzhangzy commented 6 months ago

I need detailed testing on my end, but I'm not sure how to receive this type of return? is barcodes.rawValue? for example, BarcodeType.sms, use barcodes.sms receive data.

------------------ Original ------------------ From: Navaron Bracke @.> Date: Fri,Apr 26,2024 7:03 PM To: juliansteenbakker/mobile_scanner @.> Cc: hhzhangzy @.>, Author @.> Subject: Re: [juliansteenbakker/mobile_scanner] 4.0.1 Version not Barcode Type'Product' (Issue #1044)

Can you clarify what you mean? Is BarcodeType.product never reported for barcodes that have the product type?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

navaronbracke commented 6 months ago

The rawValue of the barcode is indeed what is received by MLKit. You'll have to create a barcode which definitely has an SMS value in it. For example on the qr.io website, you can create SMS QR codes to test with.

hhzhangzy commented 6 months ago

The rawValue of the barcode is indeed what is received by MLKit. You'll have to create a barcode which definitely has an SMS value in it. For example on the qr.io website, you can create SMS QR codes to test with.

Sorry, I'm just giving an example of "BarcodeType. sms". What I mean is, in the "Barcode. dart" file, the "BarcodeType. sms" type can be received using "final SMS? Sms". So, which receive is used for "BarcodeType. product"? I didn't see any relevant code comments. In the "factory Barcode. from Native (Map<Object?, Object?>data)" method, I did not see any assignment codes that I know have for "BarcodeType. product" and "BarcodeType. text". "Final String? RawValue" can be used to receive data from "BarcodeType. text", but is it also used to receive data from "BarcodeType. product"?

navaronbracke commented 6 months ago

According to the documentation here https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode

MLKit does not provide the "data structure" behind a Product type barcode. It only provides them for things like email, person name, wifi and so on.

hhzhangzy commented 6 months ago

According to the documentation here https://developers.google.com/android/reference/com/google/mlkit/vision/barcode/common/Barcode

MLKit does not provide the "data structure" behind a Product type barcode. It only provides them for things like email, person name, wifi and so on.

So, according to MLKit SDK, it is normal to return a value of type "BarcodeType. product", but it needs to be received using "Final String? RawValue"?

navaronbracke commented 6 months ago

Yes, that looks like your only option right now.

hhzhangzy commented 6 months ago

Yes, that looks like your only option right now.

Thank you very much for your answer. The plugin you encapsulated is very good!

navaronbracke commented 6 months ago

I wonder, though, is there a specific structure that we can follow when the BarcodeType is BarcodeType.product ? Maybe we can manually parse the raw value to provide the structured data?

hhzhangzy commented 5 months ago

I wonder, though, is there a specific structure that we can follow when the BarcodeType is BarcodeType.product ? Maybe we can manually parse the raw value to provide the structured data?

The value of "rawValue" should be able to be parsed, right? However, it is necessary to ensure that "BarcodeType. product" can be returned. If it cannot be determined as "BarcodeType. product", then it can only be resolved whether "rawValue" is a pure number to determine whether it may be a product barcode.

navaronbracke commented 5 months ago

We would indeed only be parsing the rawValue as a "Product" when we know that the BarcodeType is BarcodeType.product. However, I don't know what the structure of the Product model class should look like.