addText static method

Future<String?> addText({
  1. required String text,
  2. SunmiTextStyle? style,
})

Adds text to the print buffer with an optional SunmiTextStyle.

text: The text to add. style: The optional style for the text.

Returns a String indicating the result of the operation, or null.

Implementation

static Future<String?> addText(
    {required String text, SunmiTextStyle? style}) async {
  final printData = {
    "text": text,
    if (style != null) ...style.toMap(),
  };

  return await SunmiPrinterPlusPlatform.instance.addText(printData);
}