Closed pieterbergmans closed 10 months ago
Hi...I'm trying to read a message that includes a null terminating character, \x00. The message looks like this..."\x01\x02\x8a\x00{\"errors\":null}\x03\x04". I'm using the Transaction.terminated method like this:
Transaction<Uint8List>? _transaction; _transaction = Transaction.terminated( _port!.inputStream!, Uint8List.fromList("\x03\x04".codeUnits), );
Unsurprisingly, using the following code produces null since the \x00 terminates the stream.
_transaction!.stream.listen((data) { log.i('data: $data'); });
If I remove the \x00 from the message, it works. How can I read this message with \x00?
I think that your log is truncating the data, but the data is there. Try converting it to HEX data before printing.
Hi...I'm trying to read a message that includes a null terminating character, \x00. The message looks like this..."\x01\x02\x8a\x00{\"errors\":null}\x03\x04". I'm using the Transaction.terminated method like this:
Unsurprisingly, using the following code produces null since the \x00 terminates the stream.
If I remove the \x00 from the message, it works. How can I read this message with \x00?