pos_printer_unity

pub package License: MIT

A unified Flutter plugin for POS terminal thermal printers. One API, multiple terminal brands, zero headaches.

Features

  • Unified API — Single PosPrinterUnity class for all terminal printers
  • Auto-detection — Automatically detects the terminal brand via device model
  • Text printing — Print formatted text directly
  • Bitmap printing — Print images (PNG/JPEG) as bitmaps
  • Paper feed — Control paper feeding
  • Status check — Query printer status (ready, out of paper, etc.)
  • Extensible — Easy adapter pattern to add new terminal brands

🖨️ Supported Terminals

Brand Models Status
Positivo L3, L400 ✅ Supported
PAX A910, A910S, A920, A920Pro, A930, A800, A35 ✅ Supported
Clover C305, C405 ✅ Supported
Carbon 8, 10 ✅ Supported
Ingenico A8, DX8000, DX4000 ✅ Supported
Gertec GPOS700, GPOS720, GPOS760 ✅ Supported
POSMP N910, X990 ✅ Supported
Elgin / VSP ELGIN, VSP ✅ Supported
Sunmi P2, P2-A11, D2 Mini ✅ Supported
TecToy T8, T19 ✅ Supported

Getting Started

Installation

dependencies:
  pos_printer_unity: ^0.0.1

Then run:

flutter pub get

Basic Usage

import 'package:pos_printer_unity/pos_printer_unity.dart';

final printer = PosPrinterUnity();

// Initialize (auto-detects terminal brand)
final initResult = await printer.init();
if (!initResult.success) {
  print('Error: ${initResult.errorMessage}');
  return;
}

// Print text
final result = await printer.printText('Hello from POS Printer Unity!');
print('Print ${result.success ? "OK" : "FAILED"}');

// Print a bitmap image
final bytes = await rootBundle.load('assets/receipt.png');
final bitmapResult = await printer.printBitmap(bytes.buffer.asUint8List());

// Feed paper
await printer.feedPaper(lines: 5);

// Check status
final status = await printer.getStatus();
print('Printer status: ${status.name}');

Specify a Brand

// Force Positivo printer
final result = await printer.init(brand: PrinterBrand.positivo);

API Reference

PosPrinterUnity

Method Description
init({PrinterBrand?}) Initialize the printer (auto-detect or specify brand)
printText(String) Print a text string
printBitmap(Uint8List) Print a bitmap image from bytes
feedPaper({int lines}) Feed paper by N lines
getStatus() Get current printer status
getDetectedBrand() Get the auto-detected terminal brand

PrinterBrand

enum PrinterBrand { positivo, pax, gertec, posmp, ingenico, auto }

PrinterStatus

enum PrinterStatus { ready, printing, error, outOfPaper, notInitialized, unknown }

PrintResult

class PrintResult {
  final bool success;
  final String? errorMessage;
  final int? errorCode;
}

Platform Support

Platform Supported
Android
iOS
Web

This plugin is designed exclusively for Android POS terminals with built-in thermal printers.

Adding a New Terminal Brand

  1. Create an adapter implementing IPrinterAdapter:
public class MyBrandAdapter implements IPrinterAdapter {
    @Override public void init(PrinterAdapterCallback callback) { /* ... */ }
    @Override public void printBitmap(Bitmap bitmap, PrinterAdapterCallback callback) { /* ... */ }
    @Override public void printText(String text, PrinterAdapterCallback callback) { /* ... */ }
    @Override public void feedPaper(int lines) { /* ... */ }
    @Override public String getStatus() { /* ... */ }
    @Override public String getBrand() { return "MY_BRAND"; }
}
  1. Add the vendor SDK (.aar) to the local Maven repo under android/repo/
  2. Register model detection in PrinterFactory.java
  3. Add the brand to PrinterBrand enum in Dart

License

MIT License — see LICENSE for details.

Libraries

pos_printer_unity
A unified Flutter plugin for POS terminal printers.