readImagePng static method

String readImagePng({
  1. required Uint8List bytes,
})

Implementation

static String readImagePng({
  required Uint8List bytes,
}) {
  final image = img.decodePng(bytes)!;
  final LuminanceSource source = RGBLuminanceSource(
      image.width,
      image.height,
      image
          .convert(numChannels: 4)
          .getBytes(order: img.ChannelOrder.rgba)
          .buffer
          .asInt32List());
  final bitmap = BinaryBitmap(HybridBinarizer(source));
  final reader = QRCodeReader();
  final result = reader.decode(bitmap);
  return result.text;
}