download_file_and_save_to_gallery 1.0.3
download_file_and_save_to_gallery: ^1.0.3 copied to clipboard
A Flutter package to download and store file to gallery.
A lightweight Flutter plugin to download any file (image, video, etc.) from a URL and save it directly to the gallery, with real-time progress updates and permission handling.
✨ Features
✅ Downloads files with progress feedback
🖼️ Saves images/videos to the gallery
📱 Handles Android & iOS permissions automatically
⚙️ Customizable progress callback
🔐 Supports Android 13+ scoped storage
🚀 Getting Started
Prerequisites Flutter SDK 3.10 or higher
Android SDK 21+
iOS 11.0 or higher
Add Dependency In your pubspec.yaml:
dependencies: gallery_downloader: ^1.0.3 Then run:
flutter pub get
📦 Usage Example
final result = await GalleryDownloader.downloadAndSaveToGallery( fileUrl: 'https://example.com/sample.jpg', onReceiveProgress: (received, total) { double progress = received / total * 100; print('Downloading: ${progress.toStringAsFixed(0)}%'); }, );
if (result['success']) { print('File saved at: ${result['filePath']}'); } else { print('Error: ${result['message']}'); }
🔐 Permissions This plugin automatically handles permission requests using permission_handler:
On Android 13+, no storage permission is needed
On Android ≤ 12, storage permission is requested
On iOS, no extra permission is required
Make sure to update your AndroidManifest.xml:
gradle
defaultConfig { minSdkVersion 21 }