printQRCode method

Future<int> printQRCode(
  1. String text, {
  2. ElginQrcodeSize size = ElginQrcodeSize.SIZE4,
  3. ElginAlign align = ElginAlign.CENTER,
  4. ElginQrcodeCorrection correction = ElginQrcodeCorrection.LEVEL_M,
})

Imprime um QR Code com opções de alinhamento, tamanho e correção.

text: texto a ser codificado. size: tamanho do QR Code. align: alinhamento. correction: nível de correção de erro.

Retorna o código de status da operação. Lança ElginException em caso de erro.

Implementation

Future<int> printQRCode(
  String text, {
  ElginQrcodeSize size = ElginQrcodeSize.SIZE4,
  ElginAlign align = ElginAlign.CENTER,
  ElginQrcodeCorrection correction = ElginQrcodeCorrection.LEVEL_M,
}) async {
  await reset();
  final mapParam = {
    'size': size.value,
    'align': align.value,
    'correction': correction.value,
    'text': text,
  };
  final qrcode =
      await platform?.invokeMethod("printQrcode", {'qrcodeArgs': mapParam}) ??
      9999;
  if (qrcode < 0) throw ElginException(qrcode);
  return qrcode;
}