Sunmi printer 4.1.1
Package Sunmi printer will support all sunmi devices with different behaviours
Important
THIS PACKAGE WILL WORK ONLY IN ANDROID!
This flutter plugin based Official Sunmi Inner Printer Doc using the latest implementation libs Documentation
You can help me out to keep this package updated!
Installation
flutter pub add sunmi_printer_plus
Should be a bit break change between versions below 4.0
What this package do
xWrite some text (with style or not!)xChange font sizexJump (n) linesxDraw a divisor linexBold mode on/offxPrint all types of Barcodes (see enum below)xPrint Qrcodes with custom width and error-levelxPrint image from asset or from web (example show how to print both)xPrint rows like recepit with custom width and alignmentxAble to combine with some esc/pos code that you already have!xCut paper - Dedicated method just to cut the linexPrinter serial no - Get the serial number of the printerxPrinter version - Get the printer's versionxPrinter paper size - Get the paper size ( 0: 80mm 1: 58mm)xLCD Print a imagexLCD Print a stringxOpen de cash drawerxCheck if the cash drawer is open of close
You can run the project cloning the repository below
Repository - then change branch to version-4.0

Deprecated Methods (@Deprecated)
The following methods have been kept for compatibility reasons but will be removed in future releases. Avoid using them in new implementations:
SunmiPrinter.initPrinter()SunmiPrinter.bold()SunmiPrinter.resetBold()SunmiPrinter.printRawData(Uint8List data)→ UseprintEscPos()insteadSunmiPrinter.setCustomFontSize(int size)SunmiPrinter.setAlignment(dynamic align)SunmiPrinter.resetFontSize()SunmiPrinter.setFontSize(dynamic size)SunmiPrinter.startTransactionPrint(bool trans)SunmiPrinter.exitTransactionPrint(bool trans)SunmiPrinter.bindingPrinter()SunmiPrinter.cut()→ UsecutPaper()instead
You can also combine this package with the package esc_pos_utils
With this package you can create a custom escpos and than you don't need to use any other command. This is good if you already have a code that another printers use, and u can reuse this code as well
// import packages
import 'package:sunmi_printer_plus/sunmi_printer_plus.dart';
Example code when use SunmiPrinter
await SunmiPrinter.printText('Simple raw text');
await SunmiPrinter.printText('Bold text centered',
style: SunmiTextStyle(
bold: true,
align: SunmiPrintAlign.CENTER,
));
await SunmiPrinter.lineWrap(2); // Jump 2 lines
await SunmiPrinter.printText('Very Large font!',
style: SunmiTextStyle(
fontSize: 80,
));
await SunmiPrinter.printText('Custom font size!!!',
style: SunmiTextStyle(
fontSize: 32,
));
await SunmiPrinter.printQRCode(
'https://github.com/brasizza/sunmi_printer',
style: SunmiQrcodeStyle(
qrcodeSize: 3,
errorLevel: SunmiQrcodeLevel.LEVEL_H,
)); // PRINT A QRCODE
Example code for LCD functions
await SunmiLcd.configLCD(SunmiLCDStatus)
await SunmiLcd.lcdString('Hello'); //Write a simple line
await SunmiLcd.lcdString('Hello' , 12 , true); //Write a simple line with 12 in size and fill screen
Uint8List byte = await readFileBytes('assets/images/128x40.png');
await SunmiLcd.lcdImage(byte); // Put an image in LCD
Example to open the cashier
bool await SunmiDrawer.i.isDrawerOpen(); //check if the cash drawer is connect or disconnect
await SunmiDrawer.i.openDrawer(); //open de cash drawer
List of enum printer mode
enum PrinterMode {
NORMAL_MODE,
BLACK_LABEL_MODE,
LABEL_MODE
}
List of enum Alignments
enum SunmiPrintAlign {
LEFT,
CENTER,
RIGHT,
}
List of enum Qrcode levels
enum SunmiQrcodeLevel {
LEVEL_L,
LEVEL_M,
LEVEL_Q,
LEVEL_H,
}
List of enum Barcode types
enum SunmiBarcodeType {
UPCA,
UPCE,
JAN13,
JAN8,
CODE39,
ITF,
CODABAR,
CODE93,
CODE128,
}
List of enum Text position in barcode
enum SunmiBarcodeTextPos {
NO_TEXT,
TEXT_ABOVE,
TEXT_UNDER,
BOTH,
}
List of enum Font sizes
enum SunmiFontSize {
XS,
SM,
MD,
LG,
XL,
}
List of enum SunmiLCDStatus
enum SunmiLCDStatus {
INIT,
WAKE,
SLEEP,
CLEAR,
}