listen method Null safety

  1. @Deprecated('Use stream.listen instead. Will be removed in v8.0.0')
StreamSubscription<State> listen(
  1. void onData(
    1. State
    )?,
  2. {Function? onError,
  3. void onDone(
      )?,
    1. bool? cancelOnError}
    )
    @Deprecated('Use stream.listen instead. Will be removed in v8.0.0')

    Adds a subscription to the Stream<State>. Returns a StreamSubscription which handles events from the Stream<State> using the provided onData, onError and onDone handlers.

    Implementation

    @Deprecated(
      'Use stream.listen instead. Will be removed in v8.0.0',
    )
    StreamSubscription<State> listen(
      void Function(State)? onData, {
      Function? onError,
      void Function()? onDone,
      bool? cancelOnError,
    }) {
      return stream.listen(
        onData,
        onError: onError,
        onDone: onDone,
        cancelOnError: cancelOnError,
      );
    }