flutter_image_gallery_saver 0.0.1 copy "flutter_image_gallery_saver: ^0.0.1" to clipboard
flutter_image_gallery_saver: ^0.0.1 copied to clipboard

A flutter plugin for save image to gallery.

Flutter Image Gallery Saver #

Flutter Image Gallery Saver is a Flutter plugin that provides a simple API for saving images and files (e.g., PNG, JPG, JPEG, GIF, HEIC, videos) to the device gallery. The plugin uses platform channels to communicate with native code on Android and iOS to perform the saving operations.

Features #

  • Save Image: Save image bytes (as Uint8List) directly to the gallery.
  • Save File: Save a file (image or video) from a given file path to the gallery.

Platform Setup #

Android #

No additional configuration is usually required. However, ensure that your app has the necessary permissions to write to external storage. The plugin handles most permissions, but you may need to adjust your AndroidManifest.xml for Android 6.0 and above if you encounter any issues.

iOS #

Add the following key to your Info.plist to allow the plugin to save images to the photo library:

<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires access to your photo library to save images.</string>

How to Use #

Import the Package #

import 'package:flutter_image_gallery_saver/flutter_image_gallery_saver.dart';

Saving an Image #

import 'dart:typed_data';
import 'package:flutter_image_gallery_saver/flutter_image_gallery_saver.dart';

Future<void> saveImageExample(Uint8List imageBytes) async {
  try {
    await FlutterImageGallerySaver.saveImage(imageBytes);
    print('Image saved successfully!');
  } catch (e) {
    print('Error saving image: $e');
  }
}

Saving a File #

import 'package:flutter_image_gallery_saver/flutter_image_gallery_saver.dart';

Future<void> saveFileExample(String filePath) async {
  try {
    await FlutterImageGallerySaver.saveFile(filePath);
    print('File saved successfully!');
  } catch (e) {
    print('Error saving file: $e');
  }
}
15
likes
150
points
20.1k
downloads

Publisher

verified publisherknottx.dev

Weekly Downloads

A flutter plugin for save image to gallery.

Repository (GitHub)
View/report issues

Topics

#gallery #image #saver

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_image_gallery_saver