printly library

printly — production-grade thermal printer SDK for Flutter.

This is the public barrel file. Import it as:

import 'package:printly/printly.dart';

Classes

PrintConfig
Job-wide defaults applied while building and finalising a PrintJob.
PrintJob
A fluent builder for an ESC/POS receipt.
Printly
Entry point for the printly SDK.
PrintlyBitmap
A one-bit-per-dot image, ready for the printer.
PrintlyConnectionEvent
Single connection-state transition reported by the native side.
PrintlyDevice
Immutable descriptor of a discoverable or remembered printer.
PrintlyRaster
Renders text, images and widgets into printable PrintlyBitmaps.
PrintlyScanSession
Screen-scoped scanning handle. Obtain one from Printly.instance.newScanSession() — never constructed directly.
QrSizing
Smart QR module-size calculation.
TurkishCodePage
Encodes Dart strings to the single-byte code pages thermal printers use for Turkish text.

Enums

BluetoothAdapterState
Platform-agnostic Bluetooth adapter state.
ConnectionState
Lifecycle of a single device connection.
ConnectionType
Physical transport used to reach a PrintlyDevice.
PrintlyBarcodeType
1-D barcode symbologies supported by PrintJob.barcode.
PrintlyCharset
Character encoding used when serialising text to printer bytes.
PrintlyCutMode
Paper cut behaviour emitted at the end of a job (GS V).
PrintlyDithering
How a greyscale image is reduced to the printer's one bit per dot.
PrintlyErrorCode
Machine-readable error codes shared across the Dart, Android, and iOS layers.
PrintlyHriPosition
Placement of the Human-Readable Interpretation (HRI) digits printed alongside a barcode (GS H).
PrintlyPaperWidth
Physical width of the thermal paper roll a job targets.
PrintlyPermissionStatus
Aggregate result of a Bluetooth permission request, owned by printly.
PrintlyQrErrorLevel
QR code error-correction level.
PrintlyTextAlign
Horizontal alignment of a printed line.
PrintlyTextSize
Character magnification for a printed line (GS ! n).
PrintlyTextStyle
Emphasis applied to a printed line.
PrintlyUnmappable
Policy for input characters a machine-readable payload (QR, barcode) cannot represent.
ScanStrategy
Execution strategy for ScanController.startScan.

Constants

kDefaultConnectTimeout → const Duration
Default timeout handed to ConnectionController.connect when the caller does not provide one. Classic RFCOMM typically takes ~1–3 s; BLE GATT can take longer on the first attempt while bonding completes.
kDefaultScanTimeout → const Duration
Default timeout for ScanController.startScan when the caller does not provide one. A powered, in-range thermal printer answers within the first few seconds; the remaining window only harvests anonymous ambient BLE advertisers and keeps the radio busy — measured in the field at ~100 devices in 30 s.
kDefaultScanTypes → const Set<ConnectionType>
Default set of transports to scan when the caller passes no explicit preference. Network scanning is intentionally excluded — network printers are added directly via PrintlyDevice.network.

Exceptions / Errors

PrintlyConnectionException
Opening (or keeping) a connection failed. The code distinguishes timeouts, refusals, and dropped links.
PrintlyConnectionTimeoutException
A connect attempt timed out.
PrintlyException
Base type of every error the printly SDK throws.
PrintlyPermissionException
A required Bluetooth permission is missing. Ask the user via Printly.instance.requestPermissions() (or send them to the app settings when permanently denied).
PrintlyScanException
Starting or running a device scan failed.
PrintlyUnsupportedException
The requested operation is not available — either not yet implemented (network transport, iOS printing before Sprint 6) or impossible on the platform (Bluetooth Classic on iOS without MFi).
PrintlyWriteException
Writing print data to the device failed. PrintlyErrorCode.writeTimeout and PrintlyErrorCode.disconnected are usually recoverable with a reconnect + retry; PrintlyErrorCode.notConnected means connect first.