detectBarcodesFromImages static method

Future<MultiImageBarcodeScanningResult> detectBarcodesFromImages(
  1. MethodChannel channel,
  2. List<Uri> imageFileUris, {
  3. List<BarcodeFormat> barcodeFormats = const <BarcodeFormat>[],
  4. BarcodeAdditionalParameters? additionalParameters,
  5. List<BarcodeDocumentFormat> acceptedDocumentFormats = const <BarcodeDocumentFormat>[],
})

Detect barcodes from the given images list

Implementation

static Future<MultiImageBarcodeScanningResult> detectBarcodesFromImages(
    MethodChannel channel, List<Uri> imageFileUris,
    {List<BarcodeFormat> barcodeFormats = const <BarcodeFormat>[],
    BarcodeAdditionalParameters? additionalParameters,
    List<BarcodeDocumentFormat> acceptedDocumentFormats =
        const <BarcodeDocumentFormat>[]}) async {
  try {
    var detectFromMultipleImageParams = DetectBarcodeFromImageParams(
        barcodeFormats: barcodeFormats,
        acceptedDocumentFormats: acceptedDocumentFormats,
        additionalParameters: additionalParameters,
        uris: imageFileUris);
    var barcodeScanningResult = await channel.invokeMethod(
        'detectBarcodesOnImages', detectFromMultipleImageParams.toJson());
    var result = MultiImageBarcodeScanningResult.fromJson(
        jsonDecode(barcodeScanningResult));
    return result;
  } catch (e) {
    Logger.root.severe(e);
    return MultiImageBarcodeScanningResult.error("parsing exception");
  }
}