EscPosBuilder class

ESC/POS command builder. Constructs a sequence of bytes representing commands to a thermal printer. Supports basic formatting, alignment, bold text, barcode, QR code, raster image and cut.

Constructors

EscPosBuilder()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

barcode(String data) → void
Adds a barcode using Code128 (type 73). The printer must support Code128. Data is encoded in Code Set B.
build() List<int>
Returns the complete list of bytes representing the built receipt.
cut() → void
Cuts the paper. Uses full cut by default.
feed(int lines) → void
Feeds the paper by lines lines.
init() → void
Initializes printer (ESC @) to reset modes. Safe to call multiple times.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
qrCode(String data) → void
Adds a QR code. The data is encoded using the ESC/POS QR code commands (model 2, error correction M, module size 4). This generates a square QR code. See Epson ESC/POS manual for details.
raster(List<int> bitmap) → void
Adds a raster image to the buffer. The bitmap should contain pre‑encoded ESC/POS raster data. Generating image data is outside the scope of this builder; consider using a separate utility to convert an image to mono raster bytes.
setAlign(PosAlign align) → void
Sets the alignment for subsequent text. Sent immediately when called.
text(String text, {PosAlign align = PosAlign.left, bool bold = false}) → void
Adds plain text to the buffer with optional bold and align. The default alignment is PosAlign.left.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited