qr static method
List<int>
qr(
- String text, {
- AlignPos align = AlignPos.center,
- QRSize size = QRSize.size4,
- QRCorrection cor = QRCorrection.L,
Implementation
static List<int> qr(
String text, {
AlignPos align = AlignPos.center,
QRSize size = QRSize.size4,
QRCorrection cor = QRCorrection.L,
}) {
List<int> bytes = <int>[];
const cQrHeader = '\x1D(k';
String reset = '\x1B@';
bytes += reset.codeUnits;
// FN 167. QR Code: Set the size of module
// pL pH cn fn n
bytes += cQrHeader.codeUnits + [0x03, 0x00, 0x31, 0x43] + [QRSize.size5.value];
// FN 169. QR Code: Select the error correction level
// pL pH cn fn n
bytes += cQrHeader.codeUnits + [0x03, 0x00, 0x31, 0x45] + [QRCorrection.L.value];
// FN 180. QR Code: Store the data in the symbol storage area
List<int> textBytes = latin1.encode(text);
// pL pH cn fn m
bytes += cQrHeader.codeUnits + [textBytes.length + 3, 0x00, 0x31, 0x50, 0x30];
bytes += textBytes;
// FN 182. QR Code: Transmit the size information of the symbol data in the symbol storage area
// pL pH cn fn m
bytes += cQrHeader.codeUnits + [0x03, 0x00, 0x31, 0x52, 0x30];
// FN 181. QR Code: Print the symbol data in the symbol storage area
// pL pH cn fn m
bytes += cQrHeader.codeUnits + [0x03, 0x00, 0x31, 0x51, 0x30];
return bytes;
}