analyzeImage method

Future<BarcodeCapture?> analyzeImage(
  1. String path, {
  2. List<BarcodeFormat> formats = const <BarcodeFormat>[],
})

Analyze an image file.

The path points to a file on the device. The formats specify the barcode formats that should be detected in the image. If the formats are omitted or empty, all formats are detected.

This is only supported on Android, physical iOS devices and MacOS. This is not supported on the iOS Simulator, due to restrictions on the Simulator.

Returns the BarcodeCapture that was found in the image.

If an error occurred during the analysis of the image, a MobileScannerBarcodeException error is thrown.

If analyzing images from a file is not supported, an UnsupportedError is thrown.

Implementation

Future<BarcodeCapture?> analyzeImage(
  String path, {
  List<BarcodeFormat> formats = const <BarcodeFormat>[],
}) {
  return MobileScannerPlatform.instance.analyzeImage(path, formats: formats);
}