mapEventToState method
Maps incoming MatexCountryBlocEvent to corresponding MatexCountryBlocState. Processes events and updates states accordingly.
Implementation
@override
Stream<MatexCountryBlocState> mapEventToState(event) async* {
final payload = event.payload;
final type = event.type;
if (type == MatexCountryBlocEventType.init) {
yield* handleInitEvent(payload?.jsonData ?? jsonData);
} else if (type == MatexCountryBlocEventType.initialized) {
yield* handleInitializedEvent(payload?.countries);
} else {
assert(false, 'MatexCountryBloc is not initialized yet.');
}
}