image_downloader_saver 1.0.0
image_downloader_saver: ^1.0.0 copied to clipboard
A lightweight, no-dependency Flutter plugin to download and save images to the Gallery or App Files with status codes, duplicate detection, and user preference support.
name: image_downloader_saver description: > A no-dependency Flutter plugin for downloading and saving images to the Gallery or App Files directory, with smart duplicate detection and clear HTTP-style status codes. Works fully on Android and iOS.
version: 1.0.0 author: Mohamed Elshenawy [email protected] repository: https://github.com/melshenawyarabapps/image_downloader_saver license: MIT
features:
- Save image to Gallery or Files
- Detect duplicates before saving
- Return HTTP-style status codes
- Offline and online compatible
- Native Android & iOS implementation
- No extra dependencies for saving
- Full example app included
status_codes: "200": OK (success) "201": Created (image downloaded and saved) "208": Already Exists (duplicate detected) "400": Bad Request (invalid URL or input) "401": Permission Denied (user denied access) "404": Download Failed (image not found) "500": Internal Error (native exception)
api_reference: ImageSaver.saveImage: description: > Downloads an image from a URL and saves it either to the Gallery or Files directory. parameters:
- url: The URL of the image to download
- saveTo: Optional. SaveLocation.gallery or SaveLocation.files returns: SaveResult object with status code, message, and isSuccess boolean SaveResult: description: Result model representing save outcome fields:
- code: Numeric HTTP-style status code
- message: Human-readable description
- isSuccess: Boolean (true if code is 200, 201, or 208) SaveLocation: description: Enum defining save target values:
- gallery
- files
usage_example: | import 'package:image_downloader_saver/image_downloader_saver.dart';
void main() async { final result = await ImageSaver.saveImage( 'https://picsum.photos/400', saveTo: SaveLocation.gallery, );
print('${result.code} → ${result.message}');
}
permissions: android:
- android.permission.INTERNET
- android.permission.READ_MEDIA_IMAGES
- android.permission.READ_EXTERNAL_STORAGE
- android.permission.WRITE_EXTERNAL_STORAGE (maxSdkVersion: 28) ios:
- NSPhotoLibraryAddUsageDescription: We need permission to save images to your gallery.
- NSPhotoLibraryUsageDescription: We need access to check existing images.
example_app: description: > Example Flutter app that lets the user input an image URL, choose where to save it (Gallery or Files), and view operation status. file: example/lib/main.dart dependencies:
- flutter
- image_downloader_saver (path: ../) run_command: flutter run
troubleshooting:
- problem: Image not visible in Gallery solution: Reopen the Gallery app; indexing can take a few seconds.
- problem: Permission denied solution: Ensure Photos or Storage permission is granted in Settings.
- problem: Duplicate saved images solution: Deterministic filenames prevent duplicates by default.
- problem: Download failed solution: Check the image URL and network connection.
supported_platforms: android: true ios: true web: false macos: planned windows: planned
example_output: | 201 → Image saved successfully 208 → Image already saved 404 → Download failed 401 → Permission denied
publish_steps:
- Run tests and ensure the example app works
- Validate package metadata using: flutter pub publish --dry-run
- If all checks pass, publish to pub.dev: flutter pub publish
maintainer: name: Your Name github: https://github.com/yourgithub email: [email protected]