printText static method

Future<void> printText(
  1. String text, {
  2. SunmiStyle? style,
})

printText

This method will print a simple text in your printer With the SunmiStyle you can put in one line, the size, alignment and bold

Implementation

static Future<void> printText(String text, {SunmiStyle? style}) async {
  await setAlignment(style?.align ?? SunmiPrintAlign.LEFT);
  await setFontSize(style?.fontSize ?? SunmiFontSize.MD);
  if (style?.bold == true) {
    await bold();
  }
  Map<String, dynamic> arguments = <String, dynamic>{"text": '$text\n'};
  await _channel.invokeMethod("PRINT_TEXT", arguments);
  await initPrinter();
}