onMessage method

StreamSubscription onMessage(
  1. void onData(
    1. R
    )?, {
  2. Function? onError,
  3. void onDone()?,
  4. bool? cancelOnError,
})

listen for any message from this worker

Implementation

StreamSubscription onMessage(
  void Function(R)? onData, {
  Function? onError,
  void Function()? onDone,
  bool? cancelOnError,
}) =>
    _controller.stream.listen(
      onData,
      onError: onError,
      onDone: onDone,
      cancelOnError: cancelOnError,
    );