flutter_xprinter_sdk 0.2.0
flutter_xprinter_sdk: ^0.2.0 copied to clipboard
Flutter plugin for XPrinter thermal receipt printers. Cyrillic-safe text, Floyd-Steinberg image dithering, BLE / Classic Bluetooth / USB / TCP transports.
Changelog #
0.2.0 #
Changed #
- The plugin now bundles the XPrinter native SDKs and performs initialization without a manual download/setup step in consuming apps.
Added #
- Windows 10+ support through XPrinter's ESC/POS Windows SDK 2.0.4.
- USB and TCP/IP connections on Windows.
- Windows implementations for text, bitmap, divider, QR code, barcode, feed, cut, code-page, alignment, status, and raw-command APIs.
- The x64
printer.sdk.dllis bundled with the plugin and copied into the Windows runner automatically by Flutter's build. - The Android
printer-lib-3.2.0.aaris bundled with the plugin, including its native libraries, so host apps no longer need a separate AAR copy. - The iOS
libPrinterSDK.aand vendor headers are bundled with the plugin, so host apps no longer need to run the setup command.
Platform note #
- The vendor Windows SDK does not provide direct Bluetooth discovery or
MAC-address connections. Windows Bluetooth calls return an explicit
unsupported_transporterror.
0.1.1 #
Fixed #
- Android:
BLUETOOTHandBLUETOOTH_ADMINpermissions no longer capped at API 30. Some XPrinter SDK code paths still call legacyBluetoothAdapterAPIs on Android 12+ devices and require these permissions at runtime; capping them atmaxSdkVersion="30"producedSecurityExceptionon certain MIUI / OEM-modified devices atXprinterConnection.connect.
0.1.0 #
Initial release.
Connectivity #
- Bluetooth Classic (Android) and BLE (iOS) discovery, pairing, and connect.
- USB host transport (Android only).
- TCP/IP transport (Wi-Fi / Ethernet).
Printing #
- Text rows (single line, with optional bold and alignment).
- Bold-label / plain-value information rows.
- Dotted-leader value rows (
label .... value) with auto-fallback to two-line layout when content overflows. - Fully bold rows (totals, section headers).
- Section dividers — paper-width solid line with breathing space.
- QR codes and barcodes (Code128, EAN13).
- Bitmap printing (raster, with widthDots).
- Paper feed and cut.
Cyrillic #
encodeToCp866(String)— pure-Dart Cyrillic-to-CP866 encoder. Bypasses AndroidCharsetAPI which silently returns?on devices without the CP866 charset registered.
Image preparation #
XprinterImageDither.binarise()— Floyd-Steinberg or hard threshold, auto-detects content type (logo vs photo).XprinterImageLoader.fromUrl()/.fromAsset()/.fromBytes()— download or load + resize + binarise in one call. Returns print-ready PNG bytes.
Receipt layout helpers #
XprinterLayout.configure(paperSizeMm:)— adapts character count + dot width for 58 / 72 / 80 mm.- Public layout API:
printLine,printInfoRow,printValueRow,printPlainRow,printBoldRow,printDiscountRow,printSectionDivider,printAssetIcon,printIconTextRow.
Compatibility #
- Tested on XP-58IIT (58 mm), XP-C260M (80 mm).
- iOS 14+, Android 5+ (
minSdkVersion 21).