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¶
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¶
- aplicatii-romanesti who bought me a whole month of caffeine!
Contributors¶
- honjow contributed by implementing
openDocument
Android API #110 to pick single or multiple file URIs. Really helpful, thanks! - clragon submitted a severe bug report #107 and opened discussions around package architecture #108, thanks!
- jfaltis fixed a memory leak #86 and implemented an API to override existing files #85, thanks for your contribution!
- EternityForest did report a severe crash #50 when the column ID was not provided and implemented a new feature to list all subfolders #59, thanks man!
- Thanks dhaval-k-simformsolutions for taking time to submit bug reports related to duplicated file entries!
- dangilbert pointed and fixed a bug #14 when the user doesn't select a folder, thanks man!
- A huge thanks to aplicatii-romanesti for taking time to submit device specific issues!
- I would thanks ankitparmar007 for discussing and requesting create file related APIs #20!