A flutter plugin project for Star micronics printers.
This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
import 'package:flutter_star_printer_plugin/flutter_star_printer_plugin.dart'; // find and list all the printers List<PortInfo> list = await StarPrinter.portDiscovery("LAN"); // check status // await StarPrinter.checkStatus( portName: port.portName, emulation: 'StarLine'); // Print command PrintCommands commands = PrintCommands(); String title = "Example Title\n\n"; commands.push({ 'width': 2, 'height': 2, 'appendMultiple': title, }); String text = "This is an example text for printing.\n"; commands.push({ 'append': text }); commands.push({ 'appendCutPaper': "FullCutWithFeed" }); await StarPrinter.print( portName: port.portName, emulation: 'StarLine', printCommands: commands);
Permissions required depending on your printer:
<uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>