printText method
Implementation
@override
Future<void> printText(String text, {IminTextStyle? style}) async {
Map<String, dynamic> arguments = <String, dynamic>{};
if (style != null) {
if (style.wordWrap != null && style.wordWrap == false) {
arguments.putIfAbsent('text', () => text);
} else {
arguments.putIfAbsent('text', () => '$text\n');
}
if (style.align != null) {
await setAlignment(style.align!);
}
if (style.width != null) {
await setTextWidth(style.width!);
}
if (style.fontSize != null) {
await setTextSize(style.fontSize!);
}
if (style.typeface != null) {
await setTextTypeface(style.typeface!);
}
if (style.fontStyle != null) {
await setTextStyle(style.fontStyle!);
}
} else {
arguments.putIfAbsent('text', () => '$text\n');
}
await methodChannel.invokeMethod<void>('printText', arguments);
if (style != null) {
if (style.align != null) {
await setAlignment(IminPrintAlign.left);
}
if (style.typeface != null) {
await setTextTypeface(IminTypeface.typefaceDefault);
}
if (style.fontStyle != null) {
await setTextStyle(IminFontStyle.normal);
}
}
}