convert method
Actual barcode computation method, returns a matrix of bool which represents the presence or absence of a pixel
Implementation
@override
Barcode2DMatrix convert(Uint8List data) {
var text = <int>[...data];
_CodeSize? size;
for (final s in _CodeSize.codeSizes) {
if (s.dataCodewords() >= text.length) {
size = s;
break;
}
}
if (size == null) {
throw const BarcodeException('Too much data to encode');
}
text = _addPadding(text, size.dataCodewords());
text = _ErrorCorrection.ec.calcECC(text, size);
final code = _render(text, size);
return Barcode2DMatrix(
size.columns,
size.rows,
1,
code,
);
}