saveCacheImage2Album static method

Future<SaveResult?> saveCacheImage2Album(
  1. String imageUrl, {
  2. String? fileName,
})

前提:你使用了cached_network_image来加载图片,将图片url保存到相册,返回路径

Implementation

static Future<SaveResult?> saveCacheImage2Album(String imageUrl, {String? fileName}) async {
  var file = await DefaultCacheManager().getSingleFile(imageUrl);
  if(await file.exists()){
    return await ImageUtil.saveFile2Album(file.path, fileName: fileName);
  }else{
    return null;
  }
}