THIS PACKAGE WILL WORK ONLY IN ANDROID!
It supports Sunmi and Null Safety. I developed this Flutter plugin based on the following: Official Sunmi Inner Printer Doc. However, not all methods from the documentation were included in this package because I don't have access to the equipment. If you have the equipment and can assist, please contact me on GitHub!
flutter pub add sunmi_task_printer
- Write text (with or without style)
- Change font size
- Insert line breaks
- Draw horizontal lines
- Enable or disable bold mode
- Print various types of barcodes (see enum below)
- Print QR codes with custom width and error level
- Print images from assets or the web (example demonstrates both)
- Print rows like receipts with custom width and alignment
- Combine with existing ESC/POS code
- Cut paper - Dedicated method for cutting paper
- Get the printer's serial number
- Get the printer's version
- Get the paper size (0: 80mm, 1: 58mm)
- LCD: Print an image ytyng
- LCD: Print a string with multiple lines (double lines) Thanks to ytyng
- Open the cash drawer Thanks to ZheruiL
- Check if the cash drawer is connected
- Get the number of times the cash drawer was opened
- Implement device status listener (TODO: Add methods for managing device states via a listener)
Sunmi V2 Pro
Sunmi T2 mini
Sunmi V2S
package esc_pos_utils**
With this package, you can create custom ESC/POS commands, eliminating the need for additional commands. This is beneficial if you already have code that is compatible with other printers, as you can reuse that code as well.
// Import packages
import 'package:sunmi_task_printer/sunmi_task_printer.dart';
// All methods from Sunmi Task Printer do not require asynchronous calls.
SunmiTaskPrinter.bindingPrinter(); // The plugin handles asynchronous operations automatically.
// No need to use async/await for these operations
SunmiTaskPrinter.paperSize().then((int size) {
setState(() {
paperSize = size;
});
});
SunmiTaskPrinter.printerVersion().then((String version) {
setState(() {
printerVersion = version;
});
});
SunmiTaskPrinter.serialNumber().then((String serial) {
setState(() {
serialNumber = serial;
});
});
This package is a fork of sunmi_printer_plus.