dollar_starxpand 1.0.7

SDKflutter
Platformandroidios

A comprehensive SDK for integrating Star Micronics receipt printers with Dollar POS systems. Supports seamless POS operations and efficient printing solutions.

Dollar StarXpand

Seamlessly Integrate Star Micronics Hardware with Dollar POS

Overview

Dollar StarXpand is a Flutter plugin designed to integrate Star Micronics printers and cash drawers into the Dollar POS system. This plugin provides platform-specific implementations for iOS and Android, enabling smooth communication with Star Micronics devices for printing receipts, opening cash drawers, and more.

Features

  • Discover and connect to Star Micronics printers.
  • Print receipts with customizable templates.
  • Open cash drawers programmatically.
  • Stream printer discovery events.

Installation

Add the plugin to your Flutter project by including it in your pubspec.yaml:

dependencies: 
	dollar_starxpand: latest

Run flutter pub get to fetch the package.

iOS Setup

To use the plugin on iOS, update your Info.plist file to include the required permissions:

<key>NSBluetoothPeripheralUsageDescription</key>
<string>Use Bluetooth for communication with the printer.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Use Bluetooth for communication with the printer.</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Use Local Network for communication with the printer or discovery the printers.</string>
<key>UISupportedExternalAccessoryProtocols</key>
<array>
  <string>jp.star-m.starpro</string>
</array>

Android Setup

Ensure the following permissions are added to your AndroidManifest.xml file for Bluetooth:

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

Example Usage

Import the Plugin

import 'package:dollar_starxpand/dollar_starxpand.dart';

Discover Printers

final plugin = DollarStarxpand();

await plugin.startDiscovery();
plugin.onPrinterDiscovered((identifier, interfaceType, model) {
  print("Printer found: $model ($interfaceType)");
});

Connect to a Printer

await plugin.connectPrinter(identifier: "printer_identifier", interface: "bluetooth");
await plugin.printReceipt(
  identifier: "printer_identifier",
  interface: "bluetooth",
  printData: {
    "id": "12345",
    "date": "DEC 17, 2024 12:31 AM",
    "store": {"name": "Store Name", "address": "123 Main St", "phone": "123-456-7890"},
    // Additional receipt data here
  },
);

Open Cash Drawer

await plugin.openCashDrawer(identifier: "printer_identifier", interface: "bluetooth");

Method Channels

The plugin uses the following method channels for platform communication:

  • Method Channel: dollar_starxpand
    Handles printer connection, printing, and drawer operations.

  • Event Channel: printerDiscovered
    Streams discovered printer details to Flutter.

Troubleshooting

Common Issues

  1. Printer Not Found: Ensure the printer is powered on and discoverable.
  2. Connection Failed: Verify the identifier and interface match the discovered printer details.

Contributors

We'd like to thank the following contributors for their support in developing this plugin:

License

This plugin is licensed under the MIT License.