Skip to main content

Scanning a barcode from an image file with the Flutter Barcode Scanner SDK

In addition to detecting barcodes from a live camera stream, the Barcode Scanner SDK can scan barcodes from still images imported from the gallery or any other source.

Future<Result<BarcodeScannerResult>> scanFromImageFileUri(String image, BarcodeScannerConfiguration configuration)

Future<Result<BarcodeScannerResult>> scanFromImageRef(ImageRef image, BarcodeScannerConfiguration configuration)

These methods provide the functionality of scanning barcodes from a still image, e.g. a JPG image from the device gallery or other source. The image must be passed as a file URI or ImageRef.

Set the image property as a part of the input arguments, and, in addition, you can choose which barcode formats to accept, the minimum or maximum length, or any other property that is part of the BarcodeScannerConfiguration.

With BarcodeFormatCommonConfiguration, you can configure the scanner for all barcode formats at once. In addition, you can have configurations for a specific barcode format or a format group, e.g., BarcodeFormatCommonTwoDConfiguration.

The result object:

  • result.value.barcodes: List of recognized barcodes as items. Please refer to the barcode item structure in the API documentation.
Scan barcodes from image file URI
loading...
Scan barcodes from ImageRef
loading...

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get free trial license