printString method

Future<int> printString(
  1. String text, {
  2. ElginAlign align = ElginAlign.LEFT,
  3. @Deprecated('Não tem efeito real nas impressoras Elgin e será removido em versões futuras.') bool isBold = false,
  4. @Deprecated('Não tem efeito real nas impressoras Elgin e será removido em versões futuras.') bool isUnderline = false,
  5. ElginFont font = ElginFont.FONTA,
  6. ElginSize fontSize = ElginSize.MD,
})

Imprime uma string de texto na impressora, com opções de formatação.

text: texto a ser impresso. align: alinhamento do texto (ElginAlign). isBold: DEPRECATED - não possui efeito nas impressoras Elgin. isUnderline: DEPRECATED - não possui efeito nas impressoras Elgin. font: tipo da fonte. fontSize: tamanho da fonte.

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

Implementation

Future<int> printString(
  String text, {
  ElginAlign align = ElginAlign.LEFT,
  @Deprecated(
    'Não tem efeito real nas impressoras Elgin e será removido em versões futuras.',
  )
  bool isBold = false,
  @Deprecated(
    'Não tem efeito real nas impressoras Elgin e será removido em versões futuras.',
  )
  bool isUnderline = false,
  ElginFont font = ElginFont.FONTA,
  ElginSize fontSize = ElginSize.MD,
}) async {
  await reset();
  final mapParam = {
    'text': text,
    'align': align.value,
    'font': font.value,
    'fontSize': fontSize.value,
  };
  final print =
      await platform?.invokeMethod('printText', {"textArgs": mapParam}) ??
      9999;
  if (print < 0) throw ElginException(print);
  feed(1);
  return print;
}