checkAndDownload method

Future checkAndDownload(
  1. String locale, [
  2. String? newVersion
])

检查并下载/更新 语言包

Implementation

Future checkAndDownload(String locale, [String? newVersion]) async {
  var sp = await SharedPreferences.getInstance();
  String? version = sp.getString(_intlVersionKey(locale));
  // 如果不是en,则缓存一下en的
  if (locale != _defaultLocale) {
    _log("_checkAndSaveArgs");
    _checkAndSaveArgs(_defaultLocale, newVersion);
  }
  if (version != null && version.isNotEmpty) {
    return await _downArbJson(
        locale: locale, version: version, newVersion: newVersion);
  } else {
    return await _downArbJson(locale: locale);
  }
}