printBarcode method
Future<bool>
printBarcode({
- required String data,
- int width = 380,
- int height = 100,
- bool showText = true,
- int fontSize = 16,
- int align = 1,
- int paperWidth = 52,
- bool isLabel = false,
- bool tear = true,
override
Print barcode
Implementation
@override
Future<bool> printBarcode({
required String data,
int width = 380,
int height = 100,
bool showText = true,
int fontSize = 16,
int align = 1,
int paperWidth = 52,
bool isLabel = false,
bool tear = true,
}) async {
try {
final result = await methodChannel.invokeMethod<bool>(
'printBarcode',
{
'data': data,
'width': width,
'height': height,
'showText': showText,
'fontSize': fontSize,
'align': align,
'paperWidth': paperWidth,
'isLabel': isLabel,
'tear': tear,
},
);
return result ?? false;
} catch (e) {
debugPrint('Error printing barcode: $e');
return false;
}
}