writeBytes method

  1. @override
Future<ConnectionResponse> writeBytes(
  1. List<int> data, {
  2. bool isDisconnect = true,
})
override

writeBytes let you write raw list int data into socket

Implementation

@override
Future<ConnectionResponse> writeBytes(List<int> data,
    {bool isDisconnect: true}) async {
  try {
    if (!isConnected) {
      await connect();
    }
    print(this.socket);
    this.socket?.add(data);
    if (isDisconnect) {
      await disconnect();
    }
    return ConnectionResponse.success;
  } catch (e) {
    PosPrinterManager.logger.error("Error : $e");
    return ConnectionResponse.printerNotConnected;
  }
}