starxpand

Creator: coderz1093

Last updated:

Add to Cart

Description:

starxpand

StarXpand SDK for Flutter #

A StarXpand wrapper to use Star Micronics printers.
With this plugin, your app can easily print to Star printers on Android and iOS.
Prerequisites #

Deployment Target iOS 12.0 or higher.
Android minSdkVersion 21 or higher.

iOS #
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>
copied to clipboard
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>
copied to clipboard
Installing #
Add starxpand to your pubspec.yaml:
dependencies:
starxpand:
copied to clipboard
Import starxpand:
import 'package:starxpand/starxpand.dart';
copied to clipboard
Getting Started #
Find printers:
var printers = await StarXpand.findPrinters();
setState(() {
_printers = printers;
});
copied to clipboard
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);
copied to clipboard
Available APIs #
StarXpand.findPrinters(interfaces, timeout, callback);

StarXpand.openDrawer(printer);
StarXpand.printDocument(printer, document);
StarXpand.startInputListener(printer);
StarXpand.stopInputListener(printer, guid);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.