printText method Null safety

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 {
  if (style != null) {
    if (style.align != null) {
      await setAlignment(style.align!);
    }

    if (style.fontSize != null) {
      await setFontSize(style.fontSize!);
    }

    if (style.bold != null) {
      if (style.bold == true) {
        await bold();
      }
    }
  }
  Map<String, dynamic> arguments = <String, dynamic>{"text": '$text\n'};
  await _channel.invokeMethod("PRINT_TEXT", arguments);
  await initPrinter();
}