Skip to content

Commit c660dae

Browse files
authored
Use Stream.value for single element stream (#596)
Avoids creating a single element list.
1 parent 8a031db commit c660dae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/src/byte_stream.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ByteStream extends StreamView<List<int>> {
1313
/// Returns a single-subscription byte stream that will emit the given bytes
1414
/// in a single chunk.
1515
factory ByteStream.fromBytes(List<int> bytes) =>
16-
ByteStream(Stream.fromIterable([bytes]));
16+
ByteStream(Stream.value(bytes));
1717

1818
/// Collects the data of this stream in a [Uint8List].
1919
Future<Uint8List> toBytes() {

0 commit comments

Comments
 (0)