sprint_flutter 0.1.0
sprint_flutter: ^0.1.0 copied to clipboard
sPrint for Flutter: Superroute's printing SDK. Find network, USB and Bluetooth printers, detect their language, print labels, PDF, HTML, images and raw bytes, and run a Superroute print node, on Andro [...]
sprint_flutter #
sPrint for Flutter: Superroute's printing SDK on Android, iOS, macOS, Windows and Linux. Find network, USB and Bluetooth printers, detect their command language (ZPL, TSPL, ESC/POS, CPCL and the vendor dialects), print labels, PDF, HTML, images and raw bytes, and turn the device into a Superroute print node — with the same engine as every other sPrint platform.
import 'package:sprint_flutter/sprint_flutter.dart';
final printers = await PrinterRegistry.open('${dir.path}/printers.json');
await printers.save(const TargetPrinter(name: 'Labels', host: '192.168.1.40', language: Languages.zpl));
final result = await printers.print(PrintJob(type: JobTypes.label, label: LabelJob.parse(labelJson)));
final found = await Discovery.scanNetwork();
final node = await PrintNode.create(printers, state: savedState);
node.events.listen((e) { if (e is NodeStateEvent) save(e.state.json); });
await node.pair('K2M9XY'); // the code from the Print Nodes page
await node.start();
Platform notes:
- Android: the plugin uses the sPrint Android library from
https://goodneo-solutions.github.io/sprint-releases/maven(added to your app's repositories by the plugin). Ask for Bluetooth / USB permissions in your app. - iOS / macOS: Swift Package Manager is required
(
flutter config --enable-swift-package-manager); iOS 15+, macOS 13+. AddNSBluetoothAlwaysUsageDescription(Bluetooth LE printers) andNSLocalNetworkUsageDescription(network printers) to Info.plist. - Windows / Linux: the build downloads the sPrint C library of this version from the sprint-releases Release (checked against its SHA256SUMS.txt).
Licensed under the Superroute SDK License.
Coming from superprinter_flutter #
import 'package:sprint_flutter/superprinter_compat.dart'; gives the same
LocalPrinting, PrinterRegistry, TargetPrinter, … calls (and the printers
already saved). See docs/MIGRATING-FROM-SUPERPRINTER-FLUTTER.md in the sPrint
repository for the call-by-call mapping and the behaviour differences.