📅  最后修改于: 2022-03-11 14:49:43.186000             🧑  作者: Mango
$ flutter pub add image_downloader
dependencies:
image_downloader: ^0.31.0
import 'package:image_downloader/image_downloader.dart';
try {
// Saved with this method.
var imageId = await ImageDownloader.downloadImage("https://raw.githubusercontent.com/wiki/ko2ic/image_downloader/images/flutter.png");
if (imageId == null) {
return;
}
// 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);
} on PlatformException catch (error) {
print(error);
}