cacheCurrentLang method
缓存当前语言
Implementation
void cacheCurrentLang(Locale? locale) async {
Map<String, String> map = {};
map["code"] = locale?.languageCode ?? "";
map["country_code"] = locale?.countryCode ?? "";
String langJson = JsonUtils.toJson(map);
KeepManager.instance.perform(
params: langJson,
function: (params) async {
var response = await MmkvUtils.instance.putString(_currLangCacheKey, value: Uri.encodeFull(params));
if (response.isNotEmptyString) {
MemoryUtils.instance.set(_currLangCacheKey, Uri.encodeFull(response!));
return true;
}
return false;
});
}