Flutter Image gallery saver – how to access path


I’m using Image gallery saver plugin for saving images. Method

await ImageGallerySaver.saveImage(pngBytes)

returns an object

{filePath: file:///storage/emulated/0/wallpapers/1608205629471.jpg, errorMessage: null, isSuccess: true}

I’d like to get the path of the newly saved file (/storage/emulated/0/wallpapers/1608205629471.jpg).

Is there a way to achieve that?


That is a Map object. Access the filePath String like so:

var response = await ImageGallerySaver.saveImage(pngBytes);

// value = json['key']
var path = response['filePath']; // 'file:///storage/emulated/0/wallpapers/1608205629471.jpg'

Answered By – Lee3

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *