collectBytesCancelable function Null safety

CancelableOperation<Uint8List> collectBytesCancelable (
  1. Stream<List<int>> source

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

Returns a CancelableOperation that provides the result future and a way to cancel the collection early.

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.


CancelableOperation<Uint8List> collectBytesCancelable(
    Stream<List<int>> source) {
  return _collectBytes(
      (subscription, result) => CancelableOperation.fromFuture(result,
          onCancel: subscription.cancel));