printText method

  1. @override
Future<bool> printText({
  1. required String text,
  2. String alignment = 'LEFT',
  3. int fontSize = 24,
  4. bool isBold = false,
})
override

Implementation

@override
Future<bool> printText({
  required String text,
  String alignment = 'LEFT', // LEFT, CENTER, RIGHT
  int fontSize = 24,
  bool isBold = false,
}) async {
  debugPrint('MethodChannel: printText CALLED with:');
  debugPrint('  - text: $text');
  debugPrint('  - alignment: $alignment');
  debugPrint('  - fontSize: $fontSize');
  debugPrint('  - isBold: $isBold');

  try {
    final params = {
      'text': text,
      'alignment': alignment,
      'fontSize': fontSize,
      'isBold': isBold,
    };
    debugPrint('MethodChannel: Invoking printText with params: $params');
    final bool? result = await methodChannel.invokeMethod<bool>('printText', params);
    debugPrint('MethodChannel: printText result: $result');
    return result ?? false;
  } on PlatformException catch (e) {
    throw Exception('Print failed: ${e.message}');
  }
}