printCode128 static method

List<int> printCode128(
  1. String data
)

Print Code 128 barcode

Implementation

static List<int> printCode128(String data) {
  List<int> command = [];
  List<int> dataBytes = data.codeUnits;

  // GS k - Print barcode
  command.addAll([0x1D, 0x6B]); // GS k
  command.add(0x49); // m = 73 (Code 128)
  command.add(dataBytes.length); // Length
  command.addAll(dataBytes); // Data

  return command;
}