Search categories, packages and repositories

Package detailsv2.3.2

gallery_saver

Saves images and videos from network or temporary file to external storage. Both images and videos will be visible in Android Gallery and iOS Photos.

AndroidiOS
30-day downloads
3.7K
Likes
489
Pub points
130

Install package

flutter pub add gallery_saver

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Gallery Saver is a Flutter package that enables saving images and videos from network URLs or temporary files to the device's external storage. The saved media becomes visible in the native gallery on Android and Photos app on iOS. It simplifies the process of persisting multimedia content locally, ensuring compatibility with system-level photo libraries. Ideal for apps needing to let users save shared or downloaded content directly to their device's media collection.

Use cases

  • Saving downloaded images from URLs
  • Preserving user-generated media
  • Sharing content to device gallery
  • Integrating with image/video viewers
  • Enabling offline access to media
  • Supporting social media sharing

Key features

  • Saves both images and videos
  • Works on Android and iOS
  • Visible in native gallery/photos
  • Supports network and temporary file sources
  • Simple API for saving media
  • Maintains media metadata

Suitable for

  • Media sharing apps
  • Photo viewer applications
  • Content downloaders
  • Social media integrations
  • Apps requiring offline media access
  • User-generated content platforms

Considerations

  • Requires appropriate permissions on Android
  • May need runtime permission requests
  • File size limits depend on device storage
  • iOS requires proper privacy description in Info.plist
  • Not suitable for large-scale media processing
  • Limited control over album organization

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Gallery Saver for Flutter

Saves images and videos from network or temporary file to external storage. Both images and videos will be visible in Android Gallery and iOS Photos.

NOTE: If you want to save network image or video link, it has to contain 'http/https' prefix.

Installation

First, add gallery_saver 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
Example
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:gallery_saver/gallery_saver.dart';
import 'package:image_picker/image_picker.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String firstButtonText = 'Take photo';
  String secondButtonText = 'Record video';
  double textSize = 20;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      body: Container(
        color: Colors.white,
        child: Column(
          children: <Widget>[
            Flexible(
              flex: 1,
              child: Container(
                child: SizedBox.expand(
                  child: RaisedButton(
                    color: Colors.blue,
                    onPressed: _takePhoto,
                    child: Text(firstButtonText,
                        style:
                            TextStyle(fontSize: textSize, color: Colors.white)),
                  ),
                ),
              ),
            ),
            Flexible(
              child: Container(
                  child: SizedBox.expand(
                child: RaisedButton(
                  color: Colors.white,
                  onPressed: _recordVideo,
                  child: Text(secondButtonText,
                      style: TextStyle(
                          fontSize: textSize, color: Colors.blueGrey)),
                ),
              )),
              flex: 1,
            )
          ],
        ),
      ),
    ));
  }

  void _takePhoto() async {
    ImagePicker.pickImage(source: ImageSource.camera)
        .then((File recordedImage) {
      if (recordedImage != null && recordedImage.path != null) {
        setState(() {
          firstButtonText = 'saving in progress...';
        });
        GallerySaver.saveImage(recordedImage.path).then((String path) {
          setState(() {
            firstButtonText = 'image saved!';
          });
        });
      }
    });
  }

  void _recordVideo() async {
    ImagePicker.pickVideo(source: ImageSource.camera)
        .then((File recordedVideo) {
      if (recordedVideo != null && recordedVideo.path != null) {
        setState(() {
          secondButtonText = 'saving in progress...';
        });
        GallerySaver.saveVideo(recordedVideo.path).then((String path) {
          setState(() {
            secondButtonText = 'video saved!';
          });
        });
      }
    });
  }
  void _saveNetworkVideo() async {
    String path =
        'https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4';
    GallerySaver.saveVideo(path).then((bool success) {
      setState(() {
        print('Video is saved');
      });
    });
  }

  void _saveNetworkImage() async {
    String path =
        'https://image.shutterstock.com/image-photo/montreal-canada-july-11-2019-600w-1450023539.jpg';
    GallerySaver.saveImage(path).then((bool success) {
      setState(() {
        print('Image is saved');
      });
    });
  }
}

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package