zxingReadBarcodeImageUrl function
Reads barcode from image url
Implementation
Future<Code> zxingReadBarcodeImageUrl(String url, DecodeParams params) async {
final Uint8List imageBytes =
(await NetworkAssetBundle(Uri.parse(url)).load(url)).buffer.asUint8List();
imglib.Image? image = imglib.decodeImage(imageBytes);
if (image == null) {
return Code(error: 'Failed to decode image');
}
image = resizeToMaxSize(image, params.maxSize);
params.width = image.width;
params.height = image.height;
return zxingReadBarcode(rgbBytes(image), params);
}