Index: pkg/http/lib/src/byte_stream.dart |
diff --git a/pkg/http/lib/src/byte_stream.dart b/pkg/http/lib/src/byte_stream.dart |
index d4e7f70b57e559356d4e022e3fdda2d3ad8400dc..f3546c73e9920d2667815d14e1b2e7880a31e579 100644 |
--- a/pkg/http/lib/src/byte_stream.dart |
+++ b/pkg/http/lib/src/byte_stream.dart |
@@ -23,7 +23,8 @@ class ByteStream extends StreamView<List<int>> { |
/// Collects the data of this stream in a [Uint8List]. |
Future<Uint8List> toBytes() { |
var completer = new Completer(); |
- var sink = new ByteConversionSink.withCallback(completer.complete); |
+ var sink = new ByteConversionSink.withCallback((bytes) => |
+ completer.complete(new Uint8List.fromList(bytes))); |
listen(sink.add, onError: completer.completeError, onDone: sink.close, |
cancelOnError: true); |
return completer.future; |