title: Downloading progress in dart:http
body: <p>I'm trying to make a progress bar indicator for a downloading file, but if I add a listener to the <code>StreamedResponse</code>, the piping works, but does to not finish its future.</p>
  
  <pre><code>final client = new http.Client();
  http.StreamedResponse response = await client.send(http.Request("GET", Uri.parse('someurl')));
  
  var received = 0;
  var length = response.contentLength;
  
  //if I remove this listener, the await below gets completed
  var listen = response.stream.listen((List&lt;int&gt; bytes) {
    received += bytes.length;
    print("${(received / length) * 100} %");
  });
  
  var sink = downloadFile.openWrite();
  await response.stream.pipe(sink);
  listen.cancel();
  sink.close();
  </code></pre>
  
  <p>On <a href="https://github.com/dart-lang/http/issues/211" rel="noreferrer">github</a> they already advised someone that it was supposed to work, but on <a href="https://pub.dev/documentation/http/latest/http/StreamedResponse-class.html" rel="noreferrer">StreamedResponse docs</a> stays that <code>This should always be a single-subscription stream.</code>. So, adding a listener to calculate the percentage seems to bugs <code>StreamedResponse</code> pipe in someway. Any idea on how to get this to work?</p>