Advertisement
kendy2900

print model

Apr 26th, 2022
1,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.46 KB | None | 0 0
  1. import 'package:blue_thermal_printer/blue_thermal_printer.dart';
  2.  
  3. class AppPrint {
  4.   BlueThermalPrinter con = BlueThermalPrinter.instance;
  5.  
  6.   String stripe1 = '==============================';
  7.   String stripe2 = '------------------------------';
  8.   String pesan3 = 'Test Print Berhasil';
  9.   String pesan4 = '';
  10.  
  11.   testPrint() async {
  12.     con.isConnected.then((isConnected) {
  13.       if (isConnected!) {
  14.         con.printNewLine();
  15.         con.printCustom("ALTA POS2", 1, 1);
  16.         con.printCustom("PEKALONGAN", 1, 1);
  17.         con.printCustom(stripe2, 3, 1);
  18.         con.printCustom(stripe2, 3, 1);
  19.         con.printNewLine();
  20.         con.printCustom(pesan3, 2, 1);
  21.         con.printCustom(stripe2, 3, 1);
  22.         con.printNewLine();
  23.         con.printNewLine();
  24.         con.printNewLine();
  25.       }
  26.     });
  27.   }
  28. }
  29.  
  30. class Printer {
  31.   int? id;
  32.   String? _name;
  33.   String? _address;
  34.   int? _connected;
  35.  
  36.   Printer(this._name, this._address, this._connected);
  37.  
  38.   Printer.map(dynamic obj) {
  39.     this._name = obj['name'];
  40.     this._address = obj['address'];
  41.     this._connected = obj['connected'];
  42.   }
  43.  
  44.   String? get name => _name;
  45.   String? get address => _address;
  46.   int? get connected => _connected;
  47.  
  48.   Map<String, dynamic> toMap() {
  49.     var map = Map<String, dynamic>();
  50.  
  51.     map['name'] = _name;
  52.     map['address'] = _address;
  53.     map['connected'] = _connected;
  54.  
  55.     return map;
  56.   }
  57.  
  58.   void setPrintId(int? id) {
  59.     this.id = id;
  60.   }
  61. }
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement