generate method
Image
generate()
Implementation
Image generate() {
QrImage qrImage;
if (typeNumber == 0) {
var qrCode0 = QrCode.fromData(
data: data,
errorCorrectLevel: errorCorrectLevel,
);
qrImage = QrImage(qrCode0);
} else {
var qrCode = QrCode(typeNumber, errorCorrectLevel);
qrCode.addData(data);
qrImage = QrImage(qrCode);
}
elementColor ??= ColorUint8.rgb(0, 0, 0);
backgroundColor ??= ColorUint8.rgb(255, 255, 255);
Image img = (radius == 0 ? _drawQRCodeDefault(qrImage) : _drawQRCodeRound(qrImage));
if (logo != null) {
int logoSize;
if (qrImage.typeNumber <= 2) {
logoSize = qrImage.typeNumber + 7;
} else if (qrImage.typeNumber <= 4) {
logoSize = qrImage.typeNumber + 8;
} else {
logoSize = qrImage.typeNumber + 9;
}
img = _drawLogoToQr(img, logoSize * (size / qrImage.moduleCount).floor());
}
return img;
}