listen method Null safety

StreamSubscription listen(
  1. void onData(
    1. dynamic message
    )?,
  2. {Function? onError,
  3. void onDone(
      )?,
    1. bool? cancelOnError}
    )
    override

    Listen for events from Stream.

    See Stream.listen.

    Note that onError and cancelOnError are ignored since a ReceivePort will never receive an error.

    The onDone handler will be called when the stream closes. The stream closes when close is called.

    Implementation

    StreamSubscription<dynamic> listen(void onData(var message)?,
        {Function? onError, void onDone()?, bool? cancelOnError});