image_downloader
image_downloader copied to clipboard
can't download from remoteUri
I tested with an Android phone, the Android version is 5.0.2, and I save the picture with the following log, but I can't save it
`
static Future<String> saveNetworkImageToPhoto(String url) async {
print("Run saveNetworkImageToPhoto");
try {
// Saved with this method.
var imageId = await ImageDownloader.downloadImage(url,destination: AndroidDestinationType.custom(directory: 'qzone')).catchError((error) {
if (error is PlatformException) {
var path = "";
if (error.code == "404") {
print("saveNetworkImageToPhoto:Not Found Error.");
} else if (error.code == "unsupported_file") {
print("saveNetworkImageToPhoto:UnSupported FIle Error.");
path = error.details["unsupported_file_path"];
}
print("saveNetworkImageToPhoto:path: $path");
}
});
print(" imageId = $imageId");
if (imageId == null) {
return null;
}
// Below is a method of obtaining saved image information.
var fileName = await ImageDownloader.findName(imageId);
var path = await ImageDownloader.findPath(imageId);
var size = await ImageDownloader.findByteSize(imageId);
var mimeType = await ImageDownloader.findMimeType(imageId);
print(" path = $path");
return path;
} on PlatformException catch (error) {
print(error);
}
}
`
D/image_downloader(14823): RequestResult(id=521, remoteUri=https://pic.qqhot.com/2020/05/22/YSTl1bBb.jpg, localUri=null, mediaType=null, totalSize=-1, title=, description=) D/image_downloader(14823): 0 D/image_downloader(14823): RequestResult(id=522, remoteUri=https://pic.qqhot.com/2020/05/22/3f78e713ecc6d13e1f28c31afa4cd91a.jpg, localUri=null, mediaType=null, totalSize=-1, title=, description=) D/image_downloader(14823): 0 D/image_downloader(14823): RequestResult(id=522, remoteUri=https://pic.qqhot.com/2020/05/22/3f78e713ecc6d13e1f28c31afa4cd91a.jpg, localUri=null, mediaType=null, totalSize=-1, title=, description=) D/image_downloader(14823): 0 D/image_downloader(14823): RequestResult(id=521, remoteUri=https://pic.qqhot.com/2020/05/22/YSTl1bBb.jpg, localUri=null, mediaType=null, totalSize=-1, title=, description=) D/image_downloader(14823): 0
Facing similar issue on Android 10 Is there any solution for it