cachePutFile static method

Future<File?> cachePutFile({
  1. required String url,
  2. required File file,
  3. String? cacheTag,
})

手动缓存文件

Implementation

static Future<File?> cachePutFile(
    {required String url, required File file, String? cacheTag}) async {
  final String key = keyToTagMd5(url, null, cacheTag) ?? url.md5;
  final Directory cacheImagesDirectory = Directory(
      getJoin((await getAppTemporaryDirectory()).path, cacheImageFolderName));
  if (cacheImagesDirectory.existsSync()) {
    return file.copy(getJoin(cacheImagesDirectory.path, key));
  }
  return null;
}