listen method

  1. @Deprecated('Listen to \'stream\' directly')
StreamSubscription listen(
  1. void onTransition(
    1. StateChange stateChange
    ), {
  2. Function? onError,
  3. void onDone()?,
  4. bool? cancelOnError,
})

Listen for transition events. Transition event occurs every time this transition executes successfully.

onData will be called with the State that was transitioned from.

Implementation

@Deprecated('Listen to \'stream\' directly')
StreamSubscription listen(void onTransition(StateChange stateChange),
    {Function? onError, void onDone()?, bool? cancelOnError}) {
  final streamSubscription = listenToStream(_stream, onTransition,
      onError: onError, onDone: onDone, cancelOnError: cancelOnError);
  return streamSubscription;
}