setLocalModel method

void setLocalModel(
  1. Language model
)

Implementation

void setLocalModel(Language model) {
  final List<Language> list = getLanguages();
  if (list.contains(model)) {
    _selectLanguage = model;
  } else {
    _selectLanguage = list[0];
  }
  BaseConfig.lang = getLanguageCode(_selectLanguage);
  SpUtil.putObject(BaseConfig.keyLanguageJson, _selectLanguage!.toJson());
  EventBusUtil.fire(LanguageEvent(model.toLocale()));
  Get.updateLocale(model.toLocale());
}