thermal_lib 0.0.1 copy "thermal_lib: ^0.0.1" to clipboard
thermal_lib: ^0.0.1 copied to clipboard

Lightweight Bluetooth thermal printer helper for Flutter: list devices, connect, open drawer, print/save receipts from any widget.

thermal_lib #

Lightweight Flutter helper for Bluetooth thermal printers.

  • List paired Bluetooth devices
  • Connect / disconnect
  • Open cash drawer
  • Print a receipt from any Flutter widget (offstage render)
  • Save a receipt image (PNG) from any widget

Install #

Add to your app pubspec.yaml:

dependencies:
  thermal_lib: ^0.0.1

If using a local path while iterating:

dependencies:
  thermal_lib:
    path: ../thermal_lib

Quick start #

import 'package:thermal_lib/thermal_lib.dart';

// 1) List and connect
final devices = await ThermalPrinter.instance.listPaired();
await ThermalPrinter.instance.connect(devices.first.macAdress);

// 2) Print from any widget
await ThermalPrinter.instance.printReceipt(
  context,
  SizedBox(width: 288, child: MyReceiptWidget()),
);

// 3) Open drawer
await ThermalPrinter.instance.openDrawer();

// 4) Save receipt PNG
final path = await ThermalPrinter.instance.saveReceipt(
  context,
  SizedBox(width: 288, child: MyReceiptWidget()),
  'receipt.png',
);

// 5) Disconnect
await ThermalPrinter.instance.disconnect();

MyReceiptWidget can be any widget tree. The library renders it offstage, rasterizes it, and prints it as a bitmap for high compatibility with ESC/POS printers.

Notes #

  • Defaults target 80mm printers (≈576 px). Adjust logicalWidth, pixelRatio, and PaperSize as needed.
  • Requires print_bluetooth_thermal for I/O and esc_pos_utils for raster output.

License #

MIT

0
likes
130
points
11
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Lightweight Bluetooth thermal printer helper for Flutter: list devices, connect, open drawer, print/save receipts from any widget.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

esc_pos_utils, flutter, image, path, path_provider, print_bluetooth_thermal

More

Packages that depend on thermal_lib