printText method
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}');
}
}