BlueThermalCompatPrinter class

Main compatibility facade. Collects commands into an ESC/POS builder and flushes them when requested (or on cut). Not a full re-implementation but enough for common migration scenarios.

Properties

defaultRole PosPrinterRole
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

ensureDevice({required PosPrinterRole role, required PrinterDevice device}) Future<void>
Provide a printer device mapping before printing if not already set via your app logic.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openCashDrawer() → void
Cash drawer pulse.
paperCut() → void
Paper cut.
printBarcode(String data) → void
Barcode convenience (Code128).
printCustom(String text, int size, int align) → void
Adds a custom text line using similar signature: text, size, align.
printImageAsset(String assetPath, {bool center = true, int threshold = 160, int? maxWidth, bool preferBitImage = false}) Future<void>
Convenience: load an asset image and print (auto raster). Optionally specify threshold and explicit maxWidth (dots). Falls back to legacy bit-image if raster result is empty.
printImageBytes(Uint8List bytes, {bool center = true, bool preferBitImage = false, int threshold = 160}) Future<void>
Prints raw image bytes if already ESC/POS formatted. For migration, this USED TO expect pre‑encoded ESC/POS raster. Now it auto-detects:
printLeftRight(String left, String right, int size) → void
Print a left/right aligned line (approximation using two separate draws). Original plugin tried to fit both sides in one line width; here we just print left then right with alignment adjustments.
printLogoAndLines({String? assetLogoPath, int logoThreshold = 160, int? logoMaxWidth, bool preferBitImage = false, List<CompatLine> lines = const []}) Future<void>
Combined convenience: prints (optional) asset logo followed by a list of text lines (each tuple: text, size, align). This reduces Bluetooth round‑trips versus calling multiple small printCustom and image calls separately.
printNewLine() → void
Simple newline feed.
printQRcode(String data) → void
QR code convenience.
setPaper80mm(bool is80) → void
Set paper size quickly (true = 80mm / 48 chars, false = 58mm / 32 chars)
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance BlueThermalCompatPrinter
final