HTTP response for a client connection.
HTTP response for a client connection.
The body of a HttpClientResponse object is a Stream of data from the server. Listen to the body to handle the data and be notified when the entire body is received.
new HttpClient().get('localhost', 80, '/file.txt')
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
response.transform(UTF8.decoder).listen((contents) {
// handle data
});
});