add_to_gallery 0.1.0+4 copy "add_to_gallery: ^0.1.0+4" to clipboard
add_to_gallery: ^0.1.0+4 copied to clipboard

outdated

Saves a copy of images and videos to the Android Gallery and iOS Photos

Add to Gallery #

Adds images and videos to the Android Gallery and iOS Photos

View example app

Installation #

Add add_to_gallery as a dependency in your pubspec.yaml file.

iOS #

Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

  • NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.

Android #

  • android.permission.WRITE_EXTERNAL_STORAGE - Permission for usage of external storage

Usage #

There's only one method, it returns the new path to the file in the gallery:

File file = File('/Some/Media/Path.jpg');
String path = await AddToGallery.addToGallery(
  originalFile: file,
  albumName: 'My Awesome App',
  deleteOriginalFile: false,
);
print(path);

Important Note about Google photos #

Google Photos has a built-in feature to remove exact duplicates. This can be confusing behaviour. I considered addressing this behaviour in the plugin, but decided against it. But it's worth pointing out anyhow!

Credits #

Add to Gallery is based on gallery_saver with some notable differences. Enough to warrant a new package rather than a pull-request.

Feature add_to_gallery
this package
gallery_saver
original package
Return Formats
  • Returns bool for the success of the operation.
  • This is problematic on Android. The file is copied to a new location. There's no way to know the new path.
  • This is OK on iOS. The file keeps the same URI. Think of it like a shortcut being added to the gallery.
  • Returns the path of the file in the gallery.
  • Android and iOS now behave in the same way.
  • The file is copied to a new, public location, the path is returned.
  • You are free to delete your source file after the operation.
Temporary Files
  • Unopinionated about temporary files.
  • Not a problem on Android as the file is copied (see above).
  • On iOS, there's no guarantee that a temporary file will not be deleted.
  • Always copies files to getApplicationDocumentsDirectory for persistence.
  • Always returns a new file path (see above).
Remote Files (over http)
  • Automatically downloads files that start with http.
  • Does not download files that start with http.
Album Name
  • Optional with default values.
  • Is required.
Image Manipulation
  • (Android) Automatically rotates images according to EXIF data.
  • (Android) Thumbnails are created (this is deprecated behaviour).
  • (iOS) Does not manipulate images.
  • Does not manipulate images.
24
likes
0
pub points
74%
popularity

Publisher

verified publisheroodavid.com

Saves a copy of images and videos to the Android Gallery and iOS Photos

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, http, path, path_provider, uuid

More

Packages that depend on add_to_gallery