forJob static method

PrinterStatusQuery forJob(
  1. List<int> bytes
)

TSPL jobs are plain ASCII commands (SIZE, CLS, ...); ESC/POS jobs start with a control byte.

Implementation

static PrinterStatusQuery forJob(List<int> bytes) {
  final first = bytes.firstWhere((b) => b != 0x0D && b != 0x0A, orElse: () => 0);
  final isAsciiCommand = first >= 0x41 && first <= 0x5A;
  return isAsciiCommand ? tspl : escPos;
}