shared_storage 0.1.0 shared_storage: ^0.1.0 copied to clipboard
Flutter plugin to get internal and external public directory path.
Shared Storage Flutter Plugin #
Plugin to fetch Android shared storage/folders info
Notes #
- Android Only
- Alpha version
- Supports Android 4.1+ (API Level 16+)
Features #
- Get top-level external/shared folders path from
Environment
Android API
This plugin allow us to get path of top-level shared folder (Downloads, DCIM, Videos, Audio) using the following Android API's
/// Get Android [downloads] top-level shared folder
/// You can also create a reference to a custom directory as: `EnvironmentDirectory.custom('Custom Folder')`
final sharedDirectory =
await getExternalStoragePublicDirectory(EnvironmentDirectory.downloads);
print(sharedDirectory.path); /// `/storage/emulated/0/Download`
- Get external/shared folders path from
MediaStore
Android API
/// Get Android [downloads] shared folder for Android 9+
final sharedDirectory =
await getMediaStoreContentDirectory(MediaStoreCollection.downloads);
print(sharedDirectory.path); /// `/external/downloads`
- Get root Android path, note that is a read-only folder
/// Get Android root folder
final sharedDirectory = await getRootDirectory();
print(sharedDirectory.path); /// `/system`
Android API's #
Most Flutter plugins uses Android API's under the hood. So this plugin do the same, and to retrieve Android shared folder paths the following API's are being used:
🔗 android.os.Environment
🔗 android.provider.MediaStore
Open Source
Copyright © 2021-present, Laks Castro.
Shared Storage is MIT licensed 💖