mapEventToState method

Must be implemented when a class extends BidirectionalBloc. mapEventToState is called whenever an event is added and will convert that event into a new BloC state. It can yield zero, one or several states for an event.

Implementation

@override
Stream<FastMediaLayoutBlocState> mapEventToState(
  FastMediaLayoutBlocEvent event,
) async* {
  if (event.type == FastMediaLayoutBlocEventType.changed) {
    var mediaType = event.payload as FastMediaType;

    yield currentState.copyWith(mediaType: mediaType);
  }
}