Is there a way to use an embedded barcode reader in flutter?

532 Views Asked by At

I have to develop a mobile application using flutter. The application requires the user to scan barcode, not using the phone's camera, but using a barcode embedded on the top side of the phone. Is there a way to read the result of the scan using flutter?

I searched online but I haven't found any solutions

3

There are 3 best solutions below

0
On

You don't have to embed anything to get barcode data from the barcode scanner machine. Press on TextInputField or TextField and then scan barcode with scanner, it will automatically get the scanned data in your text input field.

2
On

Usually these barcodes paste code directly as the keyboard. Just make sure the field that you want to fill is in focus, and you are set.

Source: I've worked on apps that managed inventories, we used flutter and the approach I mentioned.

0
On

I know it’s a bit late to answer but incase this helps someone else.

While you can use the text field to capture this data this is not always the nicest solution for the user as they have to first click into the text field and then start scanning. Especially if they are scanning more complex barcodes with lots of information that the user doesn't need to see.

You are thus usually able to take over the embedded scanner so that it sends the output of a scan to you rather than the input field. In order to do this you will need to write native code though. It’s hard to give an exact answer without knowing the brand of scanner but the general steps will be as follows:

  1. Look up the sdk for the specific brand of scanner you are trying to integrate into your system. The manufacturers websites usually contain details on how to get the sdk and good example code.
  2. In your code first check if you are running on that device brand that has the embedded scanner.
  3. If you are running on that device then start listening for incoming barcode scans using the code found in point 1.