transaction method
The transaction functions does 3 things.
- Flush the incoming queue
- Write the message
- Await the answer for at most "duration" time. returns List of bytes or null on timeout.
Implementation
Future<T?> transaction(
AsyncDataSinkSource port, Uint8List message, Duration duration) async {
await flush();
port.write(message);
return getMsg(duration);
}