flutter_sunmi_printer_plus 0.0.1 copy "flutter_sunmi_printer_plus: ^0.0.1" to clipboard
flutter_sunmi_printer_plus: ^0.0.1 copied to clipboard

PlatformAndroid

This plugin for Sunmi devices where you can print text, image, table, barcode and QR code.

flutter_sunmi_printer_plus #

This is plugin inspired by SunmiPrinterDemo

Platform Support #

This plugin works only on android

Usage #

To use this plugin, add flutter_sunmi_printer_plus as a dependency in your pubspec.yaml file

What this package do #

  • ✅ Print text with style (font size,bold or not,alignment,..)
  • ✅ Print image (you can set alignment)
  • ✅ Print table
  • ✅ Print qrcode (with stye)
  • ✅ Print barcode(with style)
  • ✅ Jump n-lines
  • ✅ Cut paper

Example #

Import the library.

import 'package:flutter_sunmi_printer_plus/flutter_sunmi_printer_plus.dart';

Then invoke the static initPrinter method to initiate sunmi printer .


  @override
  void initState() {
    super.initState();
    Future.delayed(Duration.zero, () async {
      try {
        isConnected = await SunmiPrinter.initPrinter() ?? false;
        setState(() {});
      } catch (err) {
        errorMessage = err.toString();
      }
      setState(() {});
    });
  }
      await SunmiPrinter.printText(
                          content: "Test String",
                          style: SunmiStyle(
                              fontSize: 20,
                              isUnderLine: true,
                              bold: false,
                              align: SunmiPrintAlign.LEFT));
 await SunmiPrinter.printImage(image: bytes, align: SunmiPrintAlign.CENTER); // bytes as Uint8List
 await SunmiPrinter.printTable(cols: [
                  ColumnMaker(text:"test#1" ,align:SunmiPrintAlign.LEFT ,width:5),
                   ColumnMaker(text:"test#2" ,align:SunmiPrintAlign.LEFT ,width: 5),
                ]);  
await SunmiPrinter.printBarCode(data: "1234567890",height: 50,width: 2,textPosition: SunmiBarcodeTextPos.TEXT_UNDER,barcodeType:SunmiBarcodeType.CODE128,align:SunmiPrintAlign.CENTER );   
await SunmiPrinter.printQr(data: "https://twitter.com/wojoodtech",align:SunmiPrintAlign.CENTER,size: 5);          

See the main.dart in the example for a complete example.

3
likes
140
pub points
76%
popularity

Publisher

verified publisherwojoodtech.com

This plugin for Sunmi devices where you can print text, image, table, barcode and QR code.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on flutter_sunmi_printer_plus