zxingReadBarcodes function

List<Code> zxingReadBarcodes(
  1. Uint8List bytes, {
  2. required int width,
  3. required int height,
  4. DecodeParams? params,
})

Reads barcodes from Uint8List image bytes

Implementation

List<Code> zxingReadBarcodes(
  Uint8List bytes, {
  required int width,
  required int height,
  DecodeParams? params,
}) {
  List<Code> results = _readBarcodes(bytes, width, height, params);
  if (results.isEmpty && params != null && params.tryInverted == true) {
    // try to invert the image and read again
    final Uint8List invertedBytes = invertImage(bytes);
    results = _readBarcodes(invertedBytes, width, height, params);
  }
  return results;
}