printText method

  1. @override
Future<void> printText(
  1. String text, {
  2. PTextAlign align = PTextAlign.left,
  3. PTextAttribute attribute = PTextAttribute.normal,
  4. PTextW width = PTextW.w1,
  5. PTextH height = PTextH.h1,
})
override

Sends a text to be printed by the printer.

Parameters:

  • text The text content to print.
  • align Text alignment (default is PTextAlign.left).
  • attribute Text attribute like bold or underline.
  • width Text width multiplier.
  • height Text height multiplier.

Implementation

@override
Future<void> printText(
  String text, {
  PTextAlign align = PTextAlign.left,
  PTextAttribute attribute = PTextAttribute.normal,
  PTextW width = PTextW.w1,
  PTextH height = PTextH.h1,
}) async {
  final args = {
    'text': text,
    'align': align.index,
    'attribute': attribute.index,
    'width': width.index,
    'height': height.index,
  };

  await methodChannel.invokeMethod<void>('printText', args);
}