handleCountryCodeChangedEvent method

Stream<FastAppSettingsBlocState> handleCountryCodeChangedEvent(
  1. FastAppSettingsBlocEventPayload? payload
)

Handle the FastAppSettingsBlocEventType.countryCodeChanged event. This event is used to change the app country code. It will persist the country code in the data provider and dispatch a new state. The new state will contain the new country code.

Implementation

Stream<FastAppSettingsBlocState> handleCountryCodeChangedEvent(
  FastAppSettingsBlocEventPayload? payload,
) async* {
  final countryCode = payload!.countryCode;
  await _persistCountryCode(countryCode);

  _logAnalyticsEvent('country_code', countryCode);

  yield currentState.copyWith(
    countryCode: () => _persistedSettings!.countryCode,
  );
}