listen method Null safety

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

    Calls callback with current value, when the value changes.

    Implementation

    StreamSubscription<T> listen(void Function(T event) onData,
        {Function? onError, void Function()? onDone, bool? cancelOnError});