handleSecondaryCurrencyCodeChangedEvent method

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

Handles the secondaryCurrencyCodeChanged event by persisting the new secondary currency code and updating the state.

The payload parameter contains the new secondary currency code.

Implementation

Stream<FastAppSettingsBlocState> handleSecondaryCurrencyCodeChangedEvent(
  FastAppSettingsBlocEventPayload? payload,
) async* {
  if (payload?.secondaryCurrencyCode != null) {
    final secondaryCurrencyCode = payload?.secondaryCurrencyCode;
    await _persistSecondaryCurrencyCode(secondaryCurrencyCode);

    _logAnalyticsEvent('secondary_currency_code', secondaryCurrencyCode);

    yield currentState.copyWith(
      secondaryCurrencyCode: _persistedSettings!.secondaryCurrencyCode,
    );
  }
}