Skip to content

Home

Check out pub.dev/shared_storage

Stability

The latest version is a Beta release, which means all these APIs can change over a short period of time without prior notice.

So, please be aware that this is plugin is not intended for production usage yet, since the API is currently in development.

Features

Current supported features are detailed below.

Summary

  • Read and write to files.
  • Pick files using a filter (e.g image/png).
  • Single or multiple file picks.
  • Picking directories.
  • Load file data immediately into memory (Uint8List) if needed.
  • Delete files/directories.
  • Getting file thumbnails as Image.memory bytes (Uint8List).
  • Launch file with third apps.
  • Request install APKs.
  • List directory contents recursively (aka file-explorer like experience).

Detailed

  • No runtime permissions are required, this package doesn't rely on MANAGE_EXTERNAL_STORAGE or any other runtime permission, only normal permissions (READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE) are implicitly used and added to your Android project.
  • Read file content as Future.
  • Read file content as Stream (planned).
  • Get file's thumbnail (APK file icons are also supported but not recommended due it's poor performance limited by SAF and PackageManager API).
  • Request install apk (requires REQUEST_INSTALL_PACKAGE permission and it's entirely optional).
  • Open and persist folders granted by the user ("Select folder" use-case).
  • Open and persist files granted by the user ("Select file" use-case).
  • Different default type filtering (media, image, video, audio or any).
  • List files inside a folder with Streams.
  • Copy file.
  • Open file with third-party apps (aka "Open with" use-case).
  • Folders and files granted can be persisted across device reboots (optional).
  • Delete file.
  • Delete folder.
  • Edit file contents.
  • Edit file contents through lazy streams (planned).
  • Move file (it's a copy + delete).

Installation

Package version badge

Use latest version when installing this plugin:

flutter pub add shared_storage

or

dependencies:
  shared_storage: ^latest # Pickup the latest version either from the pub.dev page or doc badge

Plugin

This plugin include partial support for the following APIs:

Partial Support for Environment

Mirror API from Environment

import 'package:shared_storage/environment.dart' as environment;

Partial Support for Media Store

Mirror API from MediaStore provider

import 'package:shared_storage/media_store.dart' as mediastore;

Partial Support for Storage Access Framework

Mirror API from Storage Access Framework

import 'package:shared_storage/saf.dart' as saf;

All these APIs are module based, which means they are implemented separadely and so you need to import those you want use.

To request support for some API that is not currently included open a issue explaining your usecase and the API you want to make available, the same applies for new methods or activities for the current APIs.

Contribute

If you have ideas to share, bugs to report or need support, you can open an issue.

Android APIs

Most Flutter plugins use Android API's under the hood. So this plugin does the same, and to call native Android storage APIs the following API's are being used:

đŸ”—android.os.Environment đŸ”—android.provider.MediaStore đŸ”—android.provider.DocumentsProvider

Supporters

Contributors