Navaron Bracke

fix formats for analyze image

@@ -186,6 +186,8 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { @@ -186,6 +186,8 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
186 /// Analyze an image file. 186 /// Analyze an image file.
187 /// 187 ///
188 /// The [path] points to a file on the device. 188 /// The [path] points to a file on the device.
  189 + /// The [formats] specify the barcode formats that should be detected in the image.
  190 + /// If the [formats] are omitted or empty, all formats are detected.
189 /// 191 ///
190 /// This is only supported on Android, iOS and MacOS. 192 /// This is only supported on Android, iOS and MacOS.
191 /// 193 ///
@@ -193,8 +195,11 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { @@ -193,8 +195,11 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
193 /// 195 ///
194 /// If an error occurred during the analysis of the image, 196 /// If an error occurred during the analysis of the image,
195 /// a [MobileScannerBarcodeException] error is thrown. 197 /// a [MobileScannerBarcodeException] error is thrown.
196 - Future<BarcodeCapture?> analyzeImage(String path) {  
197 - return MobileScannerPlatform.instance.analyzeImage(path); 198 + Future<BarcodeCapture?> analyzeImage(
  199 + String path, {
  200 + List<BarcodeFormat> formats = const <BarcodeFormat>[],
  201 + }) {
  202 + return MobileScannerPlatform.instance.analyzeImage(path, formats: formats);
198 } 203 }
199 204
200 /// Build a camera preview widget. 205 /// Build a camera preview widget.