barcode method

void barcode(
  1. String data, {
  2. required Barcode barcode,
  3. int width = 300,
  4. int height = 120,
  5. PrintAlign align = PrintAlign.center,
})

Implementation

void barcode(
  String data, {
  required Barcode barcode,
  int width = 300,
  int height = 120,
  PrintAlign align = PrintAlign.center,
}) {
  final bcImage = img.Image(width: width, height: height);
  fill(bcImage, color: ColorRgb8(255, 255, 255));
  Barcode.code128();
  drawBarcode(
    bcImage,
    barcode,
    data,
    font: arial24,
    width: width,
    height: height - 10,
  );
  image(
    bcImage,
    align: align,
    width: width,
    height: height,
  ); // Your image render function
}