make method

  1. @override
Iterable<BarcodeElement> make(
  1. String data, {
  2. required double width,
  3. required double height,
  4. bool drawText = false,
  5. double? fontHeight,
  6. double? textPadding,
})
override

Main method to produce the barcode graphic description. Returns a stream of drawing operations required to properly display the barcode as a UTF-8 string.

Use it with:

for (var op in Barcode.code39().make('HELLO', width: 200, height: 300)) {
  print(op);
}

Implementation

@override
Iterable<BarcodeElement> make(
  String data, {
  required double width,
  required double height,
  bool drawText = false,
  double? fontHeight,
  double? textPadding,
}) {
  final encoder = DataMatrixEncoder()..ascii(data);
  return makeBytes(
    encoder.toBytes(),
    width: width,
    height: height,
    drawText: drawText,
    fontHeight: fontHeight,
    textPadding: textPadding,
  );
}