Printable.text constructor

const Printable.text(
  1. String text, {
  2. bool clean,
  3. bool center,
  4. String? barcode,
})

A single line of text in the device's default formatting. For anything structured — formatting, images, a QR — use Printable.receipt.

Set clean to print a raw till receiptResponse as intended: the SDK decodes its HTML artefacts (
 carriage returns, & and the other entities) into the characters they stand for, so the receipt prints as a receipt rather than with the escapes showing. Off by default — ordinary text is sent through untouched.

Set center to centre each line across the printer's full width. Off by default — text prints where it was laid out.

Pass logo — a base64 PNG/JPEG (a data: URI prefix is tolerated) — to print a brand mark centred above the text. Null, the default, prints the text exactly as before. For a till receipt that wants its logo over the printed slip without composing a structured Printable.receipt.

Pass barcode — a Code 128 value — to print a centred barcode below the text, as part of the same job. Null, the default, prints nothing extra. For a till slip whose foot carries a transaction barcode: keeping it in this one job (rather than a second print) prints it on the one slip, so there is no reconnect gap and it centres on the slip's own width.

Implementation

const factory Printable.text(
  String text, {
  bool clean,
  bool center,
  String? logo,
  String? barcode,
}) = _TextPrintable;