printSticker static method

Future<void> printSticker({
  1. String? deviceId,
  2. PrinterConnectionType? connectionType,
  3. required List<Uint8List> imageBytesList,
  4. required CupStickerSize size,
})

Implementation

static Future<void> printSticker({
  String? deviceId,
  PrinterConnectionType? connectionType,
  required List<Uint8List> imageBytesList,
  required CupStickerSize size,
}) async {
  final images = <Uint8List>[];

  for (final bytes in imageBytesList) {
    images.add(await resizeImage(imageBytes: bytes, size: size));
  }

  final model = LabelModel(
    images: images,
    labelPerRow: LabelPerRow.single.copyWith(
      width: size.widthMm.toInt(),
      height: size.heightMm.toInt(),
      x: 0,
      y: 0,
    ),
  );
  await PrinterLabel.printLabel(
    deviceId: deviceId,
    connectionType: connectionType,
    barcodeImageModel: model,
  );
}