handleLanguageSelectionChanged method
Called when the user changes the language of the application.
The languageCode
parameter is the new language of the application.
Implementation
Future<void> handleLanguageSelectionChanged(
BuildContext context,
String languageCode,
) async {
final settingsBloc = FastAppSettingsBloc.instance;
settingsBloc.addEvent(
FastAppSettingsBlocEvent.languageCodeChanged(languageCode),
);
await settingsBloc.onData
.where((state) => state.languageCode == languageCode)
.first;
await context.setLocale(settingsBloc.currentState.languageLocale);
}