universal_thermal_printer 1.0.0 copy "universal_thermal_printer: ^1.0.0" to clipboard
universal_thermal_printer: ^1.0.0 copied to clipboard

Universal Thermal Printer SDK for Flutter — Bluetooth & Network (WiFi/LAN) ESC/POS thermal printer support with text, QR, barcode, images, and built-in remote license activation.

1.0.0 #

Major expansion into a full, cross-industry thermal-printing SDK. Backward compatible: ThermalPrinter, PrintTemplate, TemplateBuilder, TemplateEngine, EscPosBuilder, LicenseManager keep their existing APIs.

Receipts (data-first API) #

  • Added Receipt — a simple, imperative builder to add a header, line items (item(name, qty, rate, amount) with auto qty × rate), a totals block (subtotal, taxes/discounts, grand total, tendered + auto-computed change), dividers, spacing, QR/barcodes, a logo image and date/time — then print with ThermalPrinter.printReceipt(receipt, openDrawer: ...). Compiles to the existing template pipeline, so it inherits 58/80mm layout, non-Latin bitmap fallback, paper cut, the offline queue, retries and licensing.
  • ReceiptItemStyle.qtyRateAmount (default) and ReceiptItemStyle.nameAmount choose the item-table columns; Receipt(currency: '₹') formats money.
  • Bluetooth reconnect fix: BluetoothPrinterConnection.connect() now clears a lingering socket before reconnecting, fixing "failed to connect" on a second attempt after an unclean disconnect.
  • Bluetooth write fix: send the payload to print_bluetooth_thermal as a List<int> in a single call. Passing a Uint8List marshaled as a Java byte[], causing byte[] cannot be cast to java.util.List and every write to fail. Removing the 200-byte app-level chunking also stops the plugin's per-call newline from being injected into QR/logo raster data, which had corrupted graphics that spanned a chunk boundary.

Connectivity #

  • Added BLE (connectBLE, flutter_blue_plus) and USB (connectUSB, Android host) transports alongside Bluetooth Classic and Network.
  • Replaced the abandoned flutter_bluetooth_serial (incompatible with AGP 8/9) with the maintained print_bluetooth_thermal for Bluetooth Classic. BluetoothPrinterConnection.getPairedDevices() now returns List<PrinterDevice>.
  • USB is now opt-in, not bundled. The usb_serial plugin is unmaintained and also breaks modern Android builds (jcenter() / old Kotlin-plugin apply), so it was removed as a dependency. The connectUSB() API is preserved but reports UnsupportedTransportException until a maintained USB plugin (e.g. quick_usb) is wired in. This keeps the SDK building cleanly on all toolchains.
  • Network auto-discovery (NetworkPrinterDiscovery) — no more typing IPs.
  • Auto-reconnect with exponential backoff (autoReconnect, ReconnectPolicy).
  • PrinterManager — hold multiple named printers (receipt/kitchen) and route jobs.
  • Real-time status (queryStatus) — paper out / cover open / offline / low battery via DLE EOT.
  • Offline print queue (OfflinePrintQueue) — persists jobs and auto-flushes on reconnect.

Paper & hardware #

  • Configurable PrinterProfile — 58mm/80mm and label vs continuous; the template engine adapts column widths automatically.
  • CommandProtocol abstraction (ESC/POS today; ZPL/TSPL/CPCL can be added without breaking the public API).

Industry templates #

  • New composable elements: TableElement, TaxBreakdownElement, AddressBlockElement, BarcodeLabelElement, BigNumberElement.
  • PrebuiltTemplates for retail, restaurant KOT, logistics, pharmacy, parking, bank mini-statement, warehouse label, and queue token.

Internationalization #

  • Automatic bitmap fallback for non-Latin scripts (Hindi/Arabic/Chinese…) and symbols like via TextPainter; RTL support.

Reliability #

  • Configurable retry (RetryPolicy), typed exceptions (PaperOutException, PrinterOfflineException, …) exposed on PrintResult.exception, and an audit PrintJobLog.

Platform coverage #

  • PlatformSupport reports usable transports; unsupported transports fail with a clear UnsupportedTransportException (incl. the iOS MFi note). Identical public API across Android/iOS/Windows/Linux/macOS.

Licensing & DX #

  • Transparent licensing: configure once with a license key; end users never see one. Free mode (10 bills/day) when no key is set.
  • Firestore-direct verification on the free Spark plan (no Cloud Functions).
  • Grace period so a transient outage doesn't block checkout.
  • Admin CLI (server/admin/admin.js) to issue/revoke/list keys and set expiry/app-lock/device caps.
  • ReceiptPreview widget for on-screen print preview; rebuilt example app (printer picker → template gallery → live preview → print).

Original 0.0.x features (unchanged) #

  • Bluetooth Classic printer support (Android)
  • Network/WiFi printer support (TCP port 9100)
  • Text, QR code, barcode printing
  • Paper cut & cash drawer commands
  • Remote license activation via Firebase Cloud Function
  • Added custom template system: PrintTemplate, TemplateBuilder, TemplateEngine
  • Support for text, image/logo, QR code, barcode, divider, spacer, date/time, and two-column row elements in a template
  • Placeholder support ({{key}}) resolved from a data map at print time
  • Templates are JSON-serializable — save and reuse layouts across prints
  • Added printer.printTemplate(template, data: {...})
  • Added image printing (EscPosBuilder.image) with automatic resize + monochrome dithering for logos/signatures
3
likes
140
points
11
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Universal Thermal Printer SDK for Flutter — Bluetooth & Network (WiFi/LAN) ESC/POS thermal printer support with text, QR, barcode, images, and built-in remote license activation.

Homepage

License

unknown (license)

Dependencies

crypto, flutter, flutter_blue_plus, http, image, permission_handler, print_bluetooth_thermal, shared_preferences

More

Packages that depend on universal_thermal_printer