zcs_sdk_plugin 1.2.0 copy "zcs_sdk_plugin: ^1.2.0" to clipboard
zcs_sdk_plugin: ^1.2.0 copied to clipboard

PlatformAndroid

A Flutter plugin for ZCS SDK integration. Provides universal dynamic printing for receipts, invoices, and documents with QR codes, dual copies, and configurable layouts. Includes printRawText for simp [...]

1.2.0 Raw Text Printing #

✨ New Features #

  • Raw Text Printing: Added printRawText() method for simple text printing
    • Print plain text strings directly without formatting structure
    • Supports newline characters (\n) for multi-line printing
    • Uses default formatting (24pt font, left-aligned)
    • Perfect for simple printing needs
    • Automatic line splitting and error handling

🔧 Implementation Details #

  • Added printRawText(String text) to platform interface
  • Implemented in MethodChannel for Flutter-Android communication
  • Native Android implementation using mPrinter.setPrintAppendString()
  • Thread-safe execution on background executor
  • Comprehensive error handling

📚 Documentation #

  • Added usage examples in README.md
  • Updated example app with "Print Raw Text" button
  • Inline documentation with code examples

💡 Usage Example #

final plugin = ZcsSdkPlugin();
await plugin.initializeDevice();
await plugin.openDevice();
await plugin.printRawText('Hello, World!\nThis is a test print.\n');

1.1.0 Serial Number Support #

✨ New Features #

  • Device Serial Number Retrieval: Added getSerialNumber() method
    • Asynchronous implementation using background thread
    • Retrieves unique device serial number from ZCS SDK
    • Comprehensive error handling with detailed error messages
    • Returns String? with serial number or null on error
  • Updated example app with "Get Serial Number" button for testing

🔧 Implementation Details #

  • Added getSerialNumber() to platform interface
  • Implemented in MethodChannel for Flutter-Android communication
  • Native Android implementation using Sys.getSN() from ZCS SDK
  • Proper error code handling (SDK_OK, SDK_ERR, SDK_ERR_NOT_INIT, SDK_ERR_PARAM)
  • Thread-safe execution on background executor

📚 Documentation #

  • Added comprehensive usage examples in main plugin class
  • Inline documentation for all new methods

1.0.0 Major Refactoring #

🎉 Universal Dynamic Printing Engine #

BREAKING CHANGES:

  • Removed printText(), printReceipt(), printQRCode(), and printImage() methods
  • Replaced with single universal method: printDynamic()

✨ New Features #

  • Universal Dynamic Printing: Single printDynamic() method handles all document types
    • Receipts, invoices, reports, warehouse dispatches, and any custom document
    • Automatic field skipping for null/empty values
    • Flexible layout styles: simple, detailed, compact
    • Smart text handling with auto-wrapping and truncation
    • Dynamic QR code generation from any field
    • Dual copy printing (customer + merchant)
    • Configurable pause between copies: Added pauseBetweenCopies parameter (default: 5 seconds) to allow users to cut the first copy before the second one prints
    • Nested map support for complex data structures
    • UTF-8 support for special characters (KSh, etc.)

🔧 Architecture Improvements #

  • Helper methods for clean code organization:
    • printDocumentCopy() - Renders one copy
    • printFields() - Prints key-value pairs with recursive nesting support
    • printKeyValue() - Formats single KV lines
    • printItemsTable() - Renders items as formatted table
    • printTotals() - Prints financial totals section
    • printQRCodeHelper() - QR code generation
    • createFormat() - Text format helper
    • getStringValue() - Safe value extraction

📚 Documentation #

  • Added comprehensive DYNAMIC_PRINTING_GUIDE.md with examples
  • Added REFACTORING_SUMMARY.md documenting all changes
  • Updated README.md with new API and examples
  • Added inline code documentation

🎯 Benefits #

  • ✅ Reduced code complexity (~300 lines of duplicate code removed)
  • ✅ Maximum flexibility for any document type
  • ✅ Single API method to learn and maintain
  • ✅ Professional output with consistent formatting
  • ✅ Easy to extend for new document types

Migration Guide #

Before (v0.x):

await plugin.printText('Hello');
await plugin.printReceipt(receiptData);
await plugin.printQRCode('DATA');

After (v1.0):

await plugin.printDynamic({
  'header': 'Hello',
  'fields': {...},
  'items': [...],
  'qrCodeField': 'id',
  'id': 'DATA',
}, bothCopies: false);

0.0.1 #

  • Initial release with basic printing functionality
1
likes
130
points
249
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for ZCS SDK integration. Provides universal dynamic printing for receipts, invoices, and documents with QR codes, dual copies, and configurable layouts. Includes printRawText for simple text printing and device serial number retrieval.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on zcs_sdk_plugin

Packages that implement zcs_sdk_plugin