barcode method

Future<bool> barcode(
  1. String content, {
  2. int x = 0,
  3. int y = 0,
  4. BarcodeType type = BarcodeType.Bc_128,
  5. int height = 40,
  6. HumanReadableAlignment humanReadable = HumanReadableAlignment.Center,
  7. TbRotation rotation = TbRotation.None,
  8. int narrowBarRatio = 2,
  9. int wideBarRatio = 2,
})

Defines a barcode. @param content Barcode content. @param x Starting point in the x direction defined in dots. @param y Starting point in the y direction defined in dots. @param type Type of barcode to make. @param humanReadable Alingment of the human readable text. @param rotation degrees of rotation. @param narrowBarRatio narrow bar ratio. @param wideBarRatio wide bar ratio.

Implementation

Future<bool> barcode(String content,
    {int x = 0,
    int y = 0,
    BarcodeType type = BarcodeType.Bc_128,
    int height = 40,
    HumanReadableAlignment humanReadable = HumanReadableAlignment.Center,
    TbRotation rotation = TbRotation.None,
    int narrowBarRatio = 2,
    int wideBarRatio = 2}) async {
  var params = {
    "printerId": _printerId,
    "printInfo": _printerInfo.toMap(),
    "content": content,
    "x": x,
    "y": y,
    "type": type.getValue(),
    "height": height,
    "humanReadable": humanReadable.getValue(),
    "rotation": rotation.getValue(),
    "narrowBarRatio": narrowBarRatio,
    "wideBarRatio": wideBarRatio
  };

  final bool success = await _channel.invokeMethod("typeB-barcode", params);

  return success;
}