printText method
Future<Map<String, dynamic> >
printText(
- String text, {
- int fontSize = 50,
- bool isBold = false,
- bool isUnderline = false,
- String alignment = "LEFT",
override
text - Text to print (required)
fontSize - Font size (default: 24)
isBold - Make text bold (default: false)
isUnderline - Underline text (default: false)
alignment - Text alignment: "LEFT", "CENTER", "RIGHT" (default: "LEFT")
Implementation
/// [fontSize] - Font size (default: 24)
/// [isBold] - Make text bold (default: false)
/// [isUnderline] - Underline text (default: false)
/// [alignment] - Text alignment: "LEFT", "CENTER", "RIGHT" (default: "LEFT")
///
@override
Future<Map<String, dynamic>> printText(
String text, {
int fontSize = 50,
bool isBold = false,
bool isUnderline = false,
String alignment = "LEFT",
}) async {
try {
final Map<String, dynamic> result = Map<String, dynamic>.from(
await channel.invokeMethod('printText', {
'text': text,
'fontSize': fontSize,
'isBold': isBold,
'isUnderline': isUnderline,
'alignment': alignment,
})
);
return result;
} on PlatformException catch (e) {
throw SmartPosException('Failed to print text: ${e.message}');
}
}