Browse Source

perf(dynamite_runtime): improve the performance of collecting bytes

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/1166/head
Nikolas Rimikis 1 year ago
parent
commit
b76b1f7fa5
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 7
      packages/dynamite/dynamite_runtime/lib/src/http_extensions.dart

7
packages/dynamite/dynamite_runtime/lib/src/http_extensions.dart

@ -18,9 +18,12 @@ final _xmlBytesConverter =
/// Extension on byte streams that enable efficient transformations. /// Extension on byte streams that enable efficient transformations.
extension BytesStreamExtension on BytesStream { extension BytesStreamExtension on BytesStream {
/// Returns the all bytes of the stream. /// Collects all bytes from this stream into one Uint8List.
///
/// The collector will assume that the bytes in this stream will not change.
/// See [BytesBuilder] for further information.
Future<Uint8List> get bytes async { Future<Uint8List> get bytes async {
final buffer = BytesBuilder(); final buffer = BytesBuilder(copy: false);
await forEach(buffer.add); await forEach(buffer.add);

Loading…
Cancel
Save