listen method

StreamSubscription<List<int>> listen(
  1. void onData(
    1. List<int>
    )?, {
  2. Function? onError,
  3. void onDone()?,
  4. bool? cancelOnError,
})

Listens to the stream with the provided callback.

onData callback for data chunks onError callback for errors onDone callback when stream is done cancelOnError whether to cancel on error

Implementation

StreamSubscription<List<int>> listen(void Function(List<int>)? onData, {Function? onError, void Function()? onDone, bool? cancelOnError}) {
  return _stream.listen(
    onData,
    onError: onError,
    onDone: onDone,
    cancelOnError: cancelOnError,
  );
}