Commit 5ef85c91 authored by andrey's avatar andrey

`NetworkPrinter`: added `paperSize`, `profile`, `host`, `port` getters

parent bec0754c
## [4.0.1]
- `NetworkPrinter`: added `paperSize`, `profile`, `host`, `port` getters
## [4.0.0]
- New code generation concept: instead of generating the whole ticket, commands sent separately for each command
......
......@@ -14,17 +14,27 @@ import './enums.dart';
/// Network Printer
class NetworkPrinter {
NetworkPrinter(PaperSize paperSize, CapabilityProfile profile,
{int spaceBetweenRows = 5}) {
NetworkPrinter(this._paperSize, this._profile, {int spaceBetweenRows = 5}) {
_generator =
Generator(paperSize, profile, spaceBetweenRows: spaceBetweenRows);
}
final PaperSize _paperSize;
final CapabilityProfile _profile;
String _host;
int _port;
Generator _generator;
Socket _socket;
int get port => _port;
String get host => _host;
PaperSize get paperSize => _paperSize;
CapabilityProfile get profile => _profile;
Future<PosPrintResult> connect(String host,
{int port = 91000, Duration timeout = const Duration(seconds: 5)}) async {
_host = host;
_port = port;
try {
_socket = await Socket.connect('192.168.0.101', port, timeout: timeout);
_socket.add(_generator.reset());
......
name: esc_pos_printer
description: The library allows to print receipts using an ESC/POS thermal WiFi printer.
version: 4.0.0
version: 4.0.1
homepage: https://github.com/andrey-ushakov/esc_pos_printer
environment:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment