printText method

  1. @override
Future<int?> printText(
  1. String text,
  2. NyxTextFormat textFormat
)
override

Prints the provided text with the given format.

text The text to print. textFormat The formatting options for the text.

Returns an int representing the result of the print operation, or null if it fails.

Implementation

@override
Future<int?> printText(String text, NyxTextFormat textFormat) async {
  // Prepare the data to be sent to the native platform
  Map<String, dynamic> data = {"text": text};
  data.addAll(textFormat.toMap()); // Add the formatting options

  // Invoke the native method to print the text
  final result = await methodChannel.invokeMethod<int?>('printText', data);
  return result;
}