getCurrentLangCode method

Locale? getCurrentLangCode()

获取当前语言

Implementation

Locale? getCurrentLangCode() {
  var langJson = MemoryUtils.instance.getString(_currLangCacheKey);
  langJson = Uri.decodeFull(langJson);
  if (langJson.isEmptyString) {
    return null;
  }
  var map = JsonUtils.fromJson(langJson);
  String code = map["code"];
  String countryCode = map["country_code"];
  if (code.isEmptyString || countryCode.isEmptyString) {
    return null;
  }
  return Locale(code, countryCode);
}