A StarXpand wrapper to use Star Micronics printers.
With this plugin, your app can easily print to Star printers on Android and iOS.
- Deployment Target iOS 12.0 or higher.
- Android minSdkVersion 21 or higher.
Add reader protocol to info.plist (https://github.com/star-micronics/StarXpand-SDK-iOS) if required
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>jp.star-m.starpro</string>
</array>
Add elements to info.plist (https://github.com/star-micronics/StarXpand-SDK-iOS)
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app uses bluetooth to find, connect and print to Star printers.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Our app uses bluetooth to find, connect and print to Star printers.</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Our app uses LAN to find, connect and print to Star printers.</string>
Add starxpand to your pubspec.yaml:
dependencies:
starxpand:
Import starxpand:
import 'package:starxpand/starxpand.dart';
Find printers:
var printers = await StarXpand.findPrinters();
setState(() {
_printers = printers;
});
Print:
var doc = StarXpandDocument();
var printDoc = StarXpandDocumentPrint();
printDoc.actionPrintText("SKU Description Total\n"
"--------------------------------\n"
"300678566 PLAIN T-SHIRT 10.99\n"
"300692003 BLACK DENIM 29.99\n"
"300651148 BLUE DENIM 29.99\n"
"300642980 STRIPED DRESS 49.99\n"
"300638471 BLACK BOOTS 35.99\n"
"Subtotal 156.95\n"
"Tax 0.00\n"
"--------------------------------\n");
printDoc.actionPrintText("Total ");
printDoc.add(StarXpandDocumentPrint()
..style(magnification: StarXpandStyleMagnification(2, 2))
..actionPrintText(" \$156.95\n"));
doc.addPrint(printDoc);
doc.addDrawer(StarXpandDocumentDrawer());
StarXpand.printDocument(printer, doc);
Display:
var displayDoc = StarXpandDocumentDisplay()
..actionClearAll()
..actionClearLine()
..actionShowText("StarXpand says:\n")
..actionClearLine()
..actionShowText("Hello world!");
StarXpand.updateDisplay(printer, displayDoc);
StarXpand.getStatus(printer);
StarXpand.findPrinters(interfaces, timeout, callback);
StarXpand.updateDisplay(printer, stringData);
StarXpand.openDrawer(printer);
StarXpand.printDocument(printer, document);
StarXpand.startInputListener(printer);
StarXpand.stopInputListener(printer, guid);