close method
Closes the connection, sending status (CloseStatus.normal by
default) to the other side. The future completes when the connection
is closed.
Implementation
@override
Future<void> close([CloseStatus status = CloseStatus.normal]) {
_local ??= status;
if (!_incoming.hasListener) {
// Nobody reads yet: read on, so that the other side's answer (its
// close frame) is seen and the close completes, as dart:io's drain
// would; a later listener gets the end of the stream.
_closedUnheard = true;
_read();
}
if (_guard?.dropped ?? false) {
return Future.value();
}
return _socket.close(status.code, status.reason);
}