closeWrite method
Implementation
Future<void> closeWrite() async {
if (_localWriteClosed) return;
_localWriteClosed = true;
if (!_connected || remoteId == null || _socket == null || _socket!.closing) return;
// Send FIN via socket
_socket!.sendStreamPacket(
remoteId!,
id,
[StreamFrame(data: Uint8List(0), isFin: true)],
);
// Small delay to ensure FIN is sent
await Future.delayed(Duration(milliseconds: 50));
if (_remoteWriteClosed) {
await _close();
}
}