mapEventToState method

  1. @override
Stream<ProducersState> mapEventToState(
  1. ProducersEvent event
)

@Deprecated - Use on

Must be implemented when a class extends Bloc. mapEventToState is called whenever an event is added and is responsible for converting that event into a new state. mapEventToState can yield zero, one, or multiple states for an event.

Implementation

@override
Stream<ProducersState> mapEventToState(
  ProducersEvent event,
) async* {
  if (event is ProducerAdd) {
    yield* _mapProducerAddToState(event);
  } else if (event is ProducerRemove) {
    yield* _mapProducerRemoveToState(event);
  } else if (event is ProducerResumed) {
    yield* _mapProducerResumeToState(event);
  } else if (event is ProducerPaused) {
    yield* _mapProducerPausedToState(event);
  }
}