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] ## [4.0.0]
- New code generation concept: instead of generating the whole ticket, commands sent separately for each command - New code generation concept: instead of generating the whole ticket, commands sent separately for each command
......
...@@ -14,17 +14,27 @@ import './enums.dart'; ...@@ -14,17 +14,27 @@ import './enums.dart';
/// Network Printer /// Network Printer
class NetworkPrinter { class NetworkPrinter {
NetworkPrinter(PaperSize paperSize, CapabilityProfile profile, NetworkPrinter(this._paperSize, this._profile, {int spaceBetweenRows = 5}) {
{int spaceBetweenRows = 5}) {
_generator = _generator =
Generator(paperSize, profile, spaceBetweenRows: spaceBetweenRows); Generator(paperSize, profile, spaceBetweenRows: spaceBetweenRows);
} }
final PaperSize _paperSize;
final CapabilityProfile _profile;
String _host;
int _port;
Generator _generator; Generator _generator;
Socket _socket; Socket _socket;
int get port => _port;
String get host => _host;
PaperSize get paperSize => _paperSize;
CapabilityProfile get profile => _profile;
Future<PosPrintResult> connect(String host, Future<PosPrintResult> connect(String host,
{int port = 91000, Duration timeout = const Duration(seconds: 5)}) async { {int port = 91000, Duration timeout = const Duration(seconds: 5)}) async {
_host = host;
_port = port;
try { try {
_socket = await Socket.connect('192.168.0.101', port, timeout: timeout); _socket = await Socket.connect('192.168.0.101', port, timeout: timeout);
_socket.add(_generator.reset()); _socket.add(_generator.reset());
......
name: esc_pos_printer name: esc_pos_printer
description: The library allows to print receipts using an ESC/POS thermal WiFi 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 homepage: https://github.com/andrey-ushakov/esc_pos_printer
environment: 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