Flutter printer and cash drawer

Library use for connecting to a printer

import 'package:esc_pos_printer/esc_pos_printer.dart';

Printer.connect('', port: 9100).then((printer) {
    printer.println('Regular: aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ');
    printer.println('Special 1: àÀ èÈ éÉ ûÛ üÜ çÇ ôÔ',
        styles: PosStyles(codeTable: PosCodeTable.westEur));
    printer.println('Special 2: blåbærgrød',
        styles: PosStyles(codeTable: PosCodeTable.westEur));

    printer.println('Bold text', styles: PosStyles(bold: true));
    printer.println('Reverse text', styles: PosStyles(reverse: true));
    printer.println('Underlined text',
        styles: PosStyles(underline: true), linesAfter: 1);

    printer.println('Align left', styles: PosStyles(align: PosTextAlign.left));
    printer.println('Align center',
        styles: PosStyles(align: PosTextAlign.center));
    printer.println('Align right',
        styles: PosStyles(align: PosTextAlign.right), linesAfter: 1);
    printer.println('Text size 200%',
        styles: PosStyles(
          height: PosTextSize.size2,
          width: PosTextSize.size2,


To open cashier


  • Connect cashier to the printer  via a phone cable
  • Cable datasheet
  • Controlling the cash drawer
  • ESC POS Control
The Epson ESC POS Drawer Kick cash drawer command enables the control of either 1 or 2 Cash drawers

ESC p m t1 t2


ESC p is the drawer kick command

m is the DK connector pin to output control signals ( 0 for Pin2/drawer1  or 1 for Pin5/drawer2 )

t1 is the ON time of the drawer kick signal. The ON time is 2 mS x t1 value.

t2 is the OFF time of the drawer kick signal ( time before the next ON signal can be received ) The OFF time is 2 mS x t2 value.
  • Programming Examples
ESC p m t1 t2
  • Decimal Example
MSComm1.Output = ESC + p + 0 + 25 + 250

MSComm1.Output = Chr(27) + Chr(112) + Chr(0) + Chr(25) + Chr(250)

Kick drawer 1 with the following 50mS on / 500mS off pulse
  • Connect to the printer via a library (esc_pos_printer) and send raw command (remember done hard lock cashier, unless it can not be opened)
// nhancv: Flutter kick drawer 1 with the following 50mS on / 500mS off pulse
printer.sendRaw([27, 112, 0, 25, 250]);


The esc_pos_printer above has to limit at print QR code and open cash drawer, but thank to andrey-ushakov of course. I have made folk and add 2 extra functions mention above.


      url: git://github.com/nhancv/esc_pos_printer.git


Printer.connect('', port: 9100).then((printer) async {
    await printer.printQRCode('nhancv.com');

2 thoughts on “Flutter printer and cash drawer

Leave a Reply

Your email address will not be published.Required fields are marked *