Destroy the socket in both directions. Calling destroy will make the send a close event on the stream and will no longer react on data being piped to it.
Call close(inherited from IOSink) to only close the Socket for sending data.
void destroy();
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-io/Socket/destroy.html