2
import 'package:blue_thermal_printer/blue_thermal_printer.dart';
BlueThermalPrinter bluetooth = BlueThermalPrinter.instance;
extension PrintSize on Size {
  int get val {
    switch (this) {
      case Size.medium:
        return 0;
      case Size.bold:
        return 1;
      case Size.boldMedium:
        return 2;
      case Size.boldLarge:
        return 3;
      case Size.extraLarge:
        return 4;
      default:
        return 0;
    }
  }
}
sample() async {

    await bluetooth.isConnected.then((isConnected) {
      if (isConnected == true) {
        bluetooth.printNewLine();
        bluetooth.printCustom("Receipt", Size.boldMedium.val, Align.center.val);
        bluetooth.printNewLine();
        bluetooth.printCustom("TEST PRINT", Size.bold.val, Align.center.val);
        bluetooth.printNewLine();
        bluetooth.paperCut();
        **bluetooth.drawerPin5(); // i called this function for my drawer but nothing happen**
      }
    });

Anyone know how to trigger cash drawer especially in flutter app ? I expecting the drawer will auto open when printing the receipt after make payment.

Currently others package like esc_pos_printer all facing the issue of versioning ERROR : # Build failed due to use of deprecated Android v1 embedding.

gan jinqu
  • 21
  • 2
  • Please make sure your printer hardware has that capability. Then there are rare non-standard commands that support functionality. Please check if the command sent by the library opens the cash drawer. If you need such a printer-specific command, make sure your library has the ability to send it as a byte data array. – kunif Dec 07 '22 at 07:25
  • okay thanks, i found the problems already, just because of the sequence cause me failed to trigger drawer. i failed when i trigger drawer after the receipt print. Now i trigger drawer first before print receipt then settle – gan jinqu Jan 19 '23 at 02:58

0 Answers0