printBarcode method

Future<String?> printBarcode(
  1. String barcodeData, {
  2. String x = '10',
  3. String y = '10',
  4. int type = 4,
  5. String orientation = 'N',
  6. String height = '100',
  7. String f = 'Y',
})

Prints a barcode label.

barcodeData – the data to encode. x, y – label origin coordinates. type – barcode symbology (0=Code39, 1=EAN-8, 2=UPC-E, 3=Code93, 4=Code128, 5=EAN-13). orientation – rotation: N, R, I, or B. height – bar height in dots. f'Y' to show human-readable text, 'N' to hide it.

Implementation

Future<String?> printBarcode(
  String barcodeData, {
  String x = '10',
  String y = '10',
  int type = 4,
  String orientation = 'N',
  String height = '100',
  String f = 'Y',
}) async {
  try {
    final String? result = await _channel.invokeMethod('printBarcode', {
      'barcodeData': barcodeData,
      'x': x,
      'y': y,
      'type': type,
      'orientation': orientation,
      'height': height,
      'f': f,
    });
    return result;
  } on PlatformException catch (e) {
    throw 'Failed to print barcode: ${e.message}';
  }
}