0

I have a question to ask about how to read the data response from the socket in a for loop that writes a number of data in the network socket and for each of them must necessarily read immediately after the content to check if there are errors in the protocol, not I can hear socket.listen inside the for code. Are there any solutions to this problem? Thank you

for (var item in list){
    socket.add(item.description);
    //here i want read the response sync
    socket.read()?  

}
PosF
  • 73
  • 1
  • 1
  • 9
  • Does this help -> https://stackoverflow.com/a/51213832/1737811 – mutantkeyboard Jun 22 '22 at 11:43
  • https://api.flutter.dev/flutter/dart-async/StreamIterator-class.html maybe? – pskink Jun 22 '22 at 11:45
  • StreamIterator inside a for each , to read sync? do you have any example? Thanks – PosF Jun 22 '22 at 11:51
  • no, I do have, just try it, the docs describe how to use it - *"The current value must only be used after a future returned by moveNext has completed with true, and only until moveNext is called again"* – pskink Jun 22 '22 at 11:52

0 Answers0