collectBytes function

Future<Uint8List> collectBytes (Stream<List<int>> source)

Collects an asynchronous sequence of byte lists into a single list of bytes.

If the source stream emits an error event, the collection fails and the returned future completes with the same error.

If any of the input data are not valid bytes, they will be truncated to an eight-bit unsigned value in the resulting list.

Implementation

Future<Uint8List> collectBytes(Stream<List<int>> source) {
  return _collectBytes(source, (_, result) => result);
}