zxingReadBarcodeImagePath function

Future<Code> zxingReadBarcodeImagePath(
  1. XFile path,
  2. DecodeParams params
)

Reads barcode from XFile image path

Returns a Code carrying an error instead of throwing when the file cannot be read or decoded.

Implementation

Future<Code> zxingReadBarcodeImagePath(XFile path, DecodeParams params) async {
  final _DecodedImage decoded = await _decodeImageFile(path, params);
  if (decoded.error != null) {
    return Code(error: decoded.error, source: CodeSource.localImageFile);
  }
  return _readBarcode(
    decoded.bytes!,
    decoded.params!,
    CodeSource.localImageFile,
  );
}