totem_alecto 0.0.3 copy "totem_alecto: ^0.0.3" to clipboard
totem_alecto: ^0.0.3 copied to clipboard

PlatformAndroid

Flutter plugin package for interfacing with Totem Alecto thermal printers, providing native Android support for printing operations

0.0.3 #

Fix the method to print image to be specific to print text images to avoid gray scale in background

0.0.2 #

Downgrade SDK version to work in older apps too

0.0.1 #

Added - Initial Release #

Core Features

  • USB thermal printer communication support for Android devices
  • Support for CSN Printer SDK integration
  • Real-time printer event streaming (connection, disconnection, print completion)

Device Management

  • listDevices() - List all connected USB devices with vendor/product IDs
  • isSupported() - Check if USB Host mode is supported on the device
  • hasPermission(deviceName) - Verify USB device access permissions
  • requestPermission(deviceName) - Request USB device access with system dialog
  • connect(deviceName) - Connect to printer by device name
  • connectByIds(vendorId, productId) - Connect to printer by vendor and product IDs
  • disconnect() - Disconnect from the printer
  • isConnected() - Check current connection status

Printing Functions

  • printText(text, alignment, cutPaper) - Print simple text with alignment options
  • printTextFormatted() - Print text with advanced formatting:
    • Font attributes (bold, underline, double width, double height)
    • Font size control (width and height)
    • Font type selection
    • Text alignment (left, center, right)
  • printPicture(imageBytes, alignment, width, cutPaper) - Print images from byte array
  • printPictureBase64(base64Image, alignment, cutPaper) - Print images from Base64 string

Paper Control

  • cutPaper() - Full paper cut
  • partialCutPaper() - Partial paper cut
  • feedPaper(lines) - Feed paper by specified number of lines

Hardware Control

  • openCashDrawer(pin, onTime) - Open cash drawer with configurable pin and duration
  • beep(times, duration) - Emit beeps with configurable count and duration

Testing & Utilities

  • runTest(iterations) - Run connection and printing stress tests
  • getPlatformVersion() - Get Android platform version

Models & Types

  • UsbDeviceInfo - USB device information data class
  • PrintResult - Print operation result with success status and result code
  • PrinterEvent - Event model for printer state changes
  • PrinterEventType - Enum for event types (onOpen, onOpenFailed, onClose, onPrintComplete)
  • TextAlignment - Enum for text alignment (left, center, right)
  • FontAttributes - Font styling configuration class

Event Stream

  • printerEvents - Stream for real-time printer events monitoring

Example App

  • Complete example application demonstrating all features
  • Interactive UI with device selection
  • Real-time status updates
  • All printing and control functions

Technical Details #

  • Minimum Android SDK: API 12 (Android 3.1 - Honeycomb MR1)
  • Uses Activity-aware plugin architecture for proper USB permission handling
  • Implements CSNIOCallBack for printer state management
  • Thread-safe operations with ExecutorService
  • BroadcastReceiver integration for USB permission requests

Platform Support #

  • ✅ Android
  • ❌ iOS (not supported - USB printing not available on iOS)
2
likes
160
points
150
downloads

Publisher

verified publishermarcus.brasizza.com

Weekly Downloads

Flutter plugin package for interfacing with Totem Alecto thermal printers, providing native Android support for printing operations

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on totem_alecto

Packages that implement totem_alecto