serial_port_win32 icon indicating copy to clipboard operation
serial_port_win32 copied to clipboard

await data from SerialPort

Open JacTech opened this issue 9 months ago • 10 comments

Im fairly new to dart and Flutter so maybe this has already be implemented and i just cand find it/get it to work. Basically this is the only way i was able to receive data from my ESP8266:

String data;
 port.readBytesOnListen(16, (value) {
 data = String.fromCharCodes(value);
 print(data);
});

and as far as i understand it i can't "await" this in an async function, which i would have to do cause im waiting for a feedback from the device. Other ways of reading data like print(await port.readBytesUntil(Uint8List.fromList("\n".codeUnits))); didnt work for me i just wouldnt get any output in the console.

JacTech avatar May 10 '24 21:05 JacTech