serial_port_win32
serial_port_win32 copied to clipboard
await data from SerialPort
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.