ext_storage
ext_storage is minimal flutter plugin that provides external storage path and external public storage path.
https://pub.dev/packages/ext_storage
features
note this plugin is only supported android.
extstorage package calls android native code, environment.getexternalstoragedirectory()
and environment.getexternalstoragepublicdirectory()
.
extstorage | andorid native |
---|---|
extstorage.getexternalstoragedirectory() | environment.getexternalstoragedirectory() |
extstorage.getexternalstoragepublicdirectory() | environment.getexternalstoragepublicdirectory() |
extstorage.getexternalstoragepublicdirectory()
needs public directory type argument same as native getexternalstoragepublicdirectory()
.
extstorage | android native |
---|---|
extstorage.directory_music | environment.directory_music |
extstorage.directory_podcasts | environment.directory_podcasts |
extstorage.directory_ringtones | environment.directory_ringtones |
extstorage.directory_alarms | environment.directory_alarms |
extstorage.directory_notifications | environment.directory_notifications |
extstorage.directory_pictures | environment.directory_pictures |
extstorage.directory_movies | environment.directory_movies |
extstorage.directory_downloads | environment.directory_downloads |
extstorage.directory_dcim | environment.directory_dcim |
extstorage.directory_documents | environment.directory_documents |
extstorage.directory_screenshots | environment.directory_screenshots |
extstorage.directory_audiobooks | environment.directory_audiobooks |
installation
add ext_storage
as a dipendency in your project pubspeck.yaml
.
dependencies:
ext_storage:
and run the flutter pub get
to install.
usage
first, you write import ext_storage
package.
import 'package:ext_storage/ext_storage.dart';
and you can call two functions.
void _example1() async {
var path = await extstorage.getexternalstoragedirectory();
print(path); // /storage/emulated/0
}
void _example2() async {
var path = await extstorage.getexternalstoragepublicdirectory(extstorage.directory_pictures);
print(path); // /storage/emulated/0/pictures
}
author
yasukotelin
licence
mit licence
Comments are closed.