How to save an image to the photo gallery using Flutter?

Duncan Jones picture Duncan Jones · Apr 23, 2018 · Viewed 15.8k times · Source

My flutter app uses the camera package to take a photo, which I save to the application's data directory (obtained from path_provider and the getApplicationDocumentsDirectory() function).

How can I save this image file into the phone photo gallery? I've noticed the image_picker package allows reading from the gallery, but how can I write to it?

Answer

jelenap picture jelenap · Aug 7, 2019

https://pub.dev/packages/gallery_saver

this plugin saves images and video to gallery/photos.

You just need to provide it with path to temp file that you got from Camera(or even network url, it also works):

GallerySaver.saveVideo(recordedVideo.path);
GallerySaver.saveImage(recordedImage.path);