collect method
Concatenates all of the List
When this stream is done, the returned future is completed. For an empty stream, the future is completed with an empty Uint8List.
If this stream emits an error the returned future is completed with that error, and processing is stopped.
Implementation
Future<Uint8List> collect() async {
final builder =
await fold<BytesBuilder>(BytesBuilder(), (p, e) => p..add(e));
return builder.takeBytes();
}