convert method

  1. @override
Barcode2DMatrix convert(
  1. Uint8List data
)
override

Actual barcode computation method, returns a matrix of bool which represents the presence or absence of a pixel

Implementation

@override
Barcode2DMatrix convert(Uint8List data) {
  final errorLevel = QRErrorCorrectLevel.levels[errorCorrectLevel.index];

  final qrCode = typeNumber == null
      ? QRCodeGenerate.fromUint8List(
          data: data, errorCorrectLevel: errorLevel)
      : (QRCodeGenerate(typeNumber!, errorLevel)
        ..addByteData(data.buffer.asByteData()));

  final qrImage = QRImage(qrCode);

  return Barcode2DMatrix.fromXY(
    qrCode.moduleCount,
    qrCode.moduleCount,
    1,
    qrImage.isDark,
  );
}