패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.3.0

flutter_thermal_printer

ESC/POS 명령을 통해 열식 프린터에 인쇄하는 데 사용되는 플러터용 플러그인입니다.

AndroidiOSmacOSWindows
30일 다운로드
9.9천
좋아요
143
Pub 점수
140

패키지 설치

flutter pub add flutter_thermal_printer

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

ESC/POS 명령을 사용하여 열감지 프린터에 인쇄하는 기능을 제공하는 플러터 플러그인입니다. Android, iOS, macOS, Windows를 지원하며 개발자가 형식화된 텍스트, 바코드, 이미지를 호환되는 열감지 프린터로 직접 전송할 수 있도록 합니다. 이 패키지는 ESC/POS 명령을 발행하기 위한 간단한 API를 제공하여 유통, 숙박업, 판매점 애플리케이션에서 영수증 인쇄에 적합합니다. 플러터 앱과 원활하게 통합되며 플랫폼 채널을 통해 네이티브 플랫폼 기능을 활용합니다.

사용 사례

  • POS 시스템에서 영수증 인쇄
  • 재고용 라벨 인쇄
  • 이벤트 티켓 생성
  • 주문 확인 인쇄
  • 모바일 기반 키오스크 인쇄

주요 기능

  • ESC/POS 명령 세트를 지원합니다
  • 크로스 플랫폼 호환성
  • 텍스트, 바코드 및 이미지 인쇄
  • ESC/POS 명령어를 위한 간단한 API
  • 플랫폼 채널을 통한 네이티브 통합

적합한 대상

  • 소매 및 레스토랑 POS 앱
  • 모바일 인쇄 솔루션
  • 재고 관리 도구
  • 이벤트 및 티켓 앱
  • 키오스크 및 자가 서비스 애플리케이션

고려 사항

  • 호환되는 열식 프린터가 필요합니다
  • 고급 형식 지정을 위한 ESC/POS 명령 지식 필요
  • 블루투스 또는 USB 인쇄를 지원하는 장치에 제한
  • 플랫폼별 설정이 필요할 수 있습니다
  • 프린터 드라이버 사용 가능 여부는 운영 체제에 따라 다릅니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_thermal_printer

Buy Me A Coffee

If you find this project helpful and want to support its development, you can buy me a coffee:

Buy Me A Coffee

Getting Started

This plugin is used to print data on thermal printers with ease across multiple platforms.

🎉 New Feature: USB Printing Services

✨ Exciting Update! We now support USB printing services across multiple platforms! Connect your thermal printers directly via USB for faster, more reliable printing without the need for wireless connections.

Supported Platforms for USB:

  • 🤖 Android - Full USB support
  • 🖥️ Windows - Complete USB integration
  • 🍎 macOS - Native USB connectivity

Experience enhanced printing performance with direct USB connections!

Currently Supported

Service Android iOS macOS Windows
Bluetooth ✅ ✅ ✅ ✅
USB ✅ ✅ ✅
BLE ✅ ✅ ✅ ✅
WiFi ✅ ✅ ✅ ✅
final _flutterThermalPrinterPlugin = FlutterThermalPrinter.instance;

// Enum ConnectionType
enum ConnectionType {
  BLE,
  USB,
  NETWORK,
}

// Additional Functions
// Recommended Function for getting printers
getPrinters(
  refreshDuration: Duration,
  connectionTypes: List<ConnectionType>,
) {
  // Supports WINDOWS, ANDROID , Macos for USB
  // MAC, IOS, ANDROID, WINDOWS for BLUETOOTH.
}

// Refer to Example for Complete code 

macOS printer connection types

Installed macOS print queues are classified using their native device URI: usb:// is USB; dnssd://, ipp://, ipps://, http://, https://, socket://, lpd://, and smb:// are NETWORK. Unknown or missing schemes have a null connectionType and display as UNKNOWN.

await FlutterThermalPrinter.instance.getPrinters(
  connectionTypes: [ConnectionType.USB, ConnectionType.BLE, ConnectionType.NETWORK],
);

The default scan includes all three types. An explicit USB-only scan excludes network queues; a NETWORK-only scan returns installed network queues on macOS. Unknown system queues appear when both USB and NETWORK are requested. This does not discover uninstalled LAN printers or identify thermal/ESC/POS compatibility.

Printer.deviceUri preserves the destination URI and Printer.queueName holds the macOS queue ID. System queues continue printing through the native macOS backend, including printWidget; a Bonjour/IPPS URI is not passed to the raw TCP network printer API. The queue's isConnected value still indicates that it is installed, not that the physical printer is reachable. Other platforms retain their existing discovery mechanisms.

Bluetooth Services

Feature Android iOS macOS Windows
Start scanning ✅ ✅ ✅ ✅
Stop scanning ✅ ✅ ✅ ✅
Connect printer ✅ ✅ ✅ ✅
Disconnect printer ✅ ✅ ✅ ✅
Print data ✅ ✅ ✅ ✅
Print widget ✅ ✅ ✅ ✅

USB Services

Feature Android iOS macOS Windows
Start scanning ✅ ✅ ✅
Stop scanning ✅ ✅ ✅
Connect printer ✅ ✅ ✅
Print data ✅ ✅ ✅
Print widget ✅ ✅ ✅

WiFi Services

Feature Android iOS macOS Windows
Connect printer ✅ ✅ ✅ ✅
Disconnect printer ✅ ✅ ✅ ✅
Print data ✅ ✅ ✅ ✅
Print widget ✅ ✅ ✅ ✅

Printer Model Class

String? address;
String? name;
ConnectionType? connectionType;
bool? isConnected;
String? vendorId;
String? productId;

Additional Features

Screenshot to Printer

Easily capture and print widgets as images using the printWidget method.

Image Cropping for Long Prints

Handles long data by cropping images and printing them in chunks to ensure seamless printing on devices with limited buffer capacity.

Connection Type Validation
  • Ensures ConnectionType compatibility and alerts when unsupported combinations are used.
BLE State Monitoring

Provides real-time monitoring for Bluetooth states, ensuring proactive error handling and reconnections.

BLE Connection Configuration

Customize BLE connection behavior to optimize for different printer models:

// Global configuration (applies to all BLE connections)
FlutterThermalPrinter.instance.bleConfig =
    BleConfig(connectionStabilizationDelay: Duration(seconds: 3));

// Per-connection override for specific devices
await FlutterThermalPrinter.instance.connect(
  printer,
  connectionStabilizationDelay: Duration(seconds: 2),
);

// Default behavior (10 seconds) - no configuration needed
await FlutterThermalPrinter.instance.connect(printer);
Configuration Use Case
Global config Set once for consistent behavior across all connections
Per-call override Fine-tune for specific printer models that connect faster/slower
Default (10s) Backwards compatible, works with most printers

Notes and Recommendations

  • Windows & MacOS Users: Make sure you have the XPrinter driver installed on Windows for printer compatibility.
    Download the driver from XPrinter Driver.

  • Cross-Platform Usage: Ensure Bluetooth permissions and configurations are set correctly for Android and iOS.


Contributing Guidelines

We welcome contributions to enhance the plugin's functionality!
To contribute, please fork the repository, make changes, and submit a pull request.
For bug reports or feature requests, feel free to open an issue.


Contributors

Contributors

Feel free to contribute to this project and help make it better for everyone!


카테고리

의존성

의존성 목록 7 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.