Chromium Code Reviews| 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 c75654a28e9b656dc5877582904d289f472179ef..a15475745d5cc048fc196902ebbdbd200724e958 100644 |
| --- a/pkg/http/lib/src/byte_stream.dart |
| +++ b/pkg/http/lib/src/byte_stream.dart |
| @@ -23,11 +23,8 @@ class ByteStream extends StreamView<List<int>> { |
| /// Collects the data of this stream in a [Uint8List]. |
| Future<Uint8List> toBytes() { |
| - /// TODO(nweiz): use BufferList when issue 6409 is fixed. |
| - return fold(<int>[], (buffer, chunk) { |
| - buffer.addAll(chunk); |
| - return buffer; |
| - }).then(toUint8List); |
| + return fold(new BytesBuilder(), (builder, chunk) => builder..add(chunk)) |
| + .then((builder) => builder.takeBytes()); |
|
nweiz
2013/11/01 18:31:19
Indent this two more spaces.
Anders Johnsen
2013/11/04 07:13:34
Done: https://codereview.chromium.org/57653002
|
| } |
| /// Collect the data of this stream in a [String], decoded according to |