drawBarcodeBytes function

void drawBarcodeBytes(
  1. Image image,
  2. Barcode barcode,
  3. Uint8List bytes, {
  4. int x = 0,
  5. int y = 0,
  6. int? width,
  7. int? height,
  8. BitmapFont? font,
  9. int? textPadding,
  10. int color = 0xff000000,
})

Create a Barcode

Implementation

void drawBarcodeBytes(
  Image image,
  Barcode barcode,
  Uint8List bytes, {
  int x = 0,
  int y = 0,
  int? width,
  int? height,
  BitmapFont? font,
  int? textPadding,
  int color = 0xff000000,
}) {
  width ??= image.width;
  height ??= image.height;
  textPadding ??= 0;

  final recipe = barcode.makeBytes(
    bytes,
    width: width.toDouble(),
    height: height.toDouble(),
    drawText: font != null,
    fontHeight: font?.lineHeight.toDouble(),
    textPadding: textPadding.toDouble(),
  );

  _drawBarcode(image, recipe, x, y, font, color);
}