Reputation: 3899
I'm working with saved image from Url with Gallery Saver. Everything it's oke , i can insert image from URL, but i don't know how to fetch image from picture Directory .
It's different about getApplicationDocumentsDirectory()
or getExternalStorageDirectory()
?
I want to display the image that was just saved.
Any solution ?
void _testSaveImage() async {
String path = "${Urls.BASE_API_IMAGE}/berita/${widget.gambarBerita}";
GallerySaver.saveImage(path).then((bool success) {
print('Success add image $path');
}).catchError((onError) {
print('Error add image $path');
});
}
Upvotes: 1
Views: 2385
Reputation: 2705
Then just return the path
you have and use a Image.file()
widget to display it, lets say you have a Column()
:
Column(children: <Widget>[
[...]
Text('Here is my image:'),
if (path.isNotEmpty && path != null)
SizedBox(
height: 200,
width: 200,
child: Image.file(File(path),
),
Text('Caption of the image'),
[...]
),
Docs for Image class here
Upvotes: 1
Reputation: 11457
Load local saved images using path and use it
var file = new File('path');
Image.file(file )
Upvotes: 0