dartgalleryflutterphoto

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


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?


Solution

  • Unfortunately flutter doesn't currently expose that functionality. It does seem like a candidate for a plugin though.

    If you're motivated enough, you could use platform channels to communicate from flutter to native Android (and iOS) code, from which you can get full access the gallery. Bonus points if you make it into a plugin and publish it!