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()?  

}
4
  • Does this help -> stackoverflow.com/a/51213832/1737811 Commented Jun 22, 2022 at 11:43
  • api.flutter.dev/flutter/dart-async/StreamIterator-class.html maybe? Commented Jun 22, 2022 at 11:45
  • StreamIterator inside a for each , to read sync? do you have any example? Thanks Commented Jun 22, 2022 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" Commented Jun 22, 2022 at 11:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.