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<FastFirebaseRemoteConfigBlocState> mapEventToState(
  FastFirebaseRemoteConfigBlocEvent event,
) async* {
  final payload = event.payload;
  final type = event.type;

  if (type == FastFirebaseRemoteConfigBlocEventType.init) {
    yield* handleInitEvent(payload?.defaultConfig);
  } else if (type == FastFirebaseRemoteConfigBlocEventType.initialized) {
    yield* handleInitializedEvent(isActivated: payload?.activated);
  } else {
    assert(false, 'FastFirebaseRemoteConfigBloc is not initialized yet.');
  }
}