android_external_storage

android_external_storage is minimal flutter plugin for accessing android's external/shared storage path. This plugin is based on https://pub.dev/packages/ext_storage plugin.

Features

NOTE This plugin only support Android.

AndroidExternalStorage package calls Android native code.

AndroidExternalStorageAndroid Native
AndroidExternalStorage.getExternalStorageDirectory()Environment.getExternalStorageDirectory()
AndroidExternalStorage.getExternalStoragePublicDirectory()Environment.getExternalStoragePublicDirectory()
AndroidExternalStorage.getRootDirectory()Environment.getRootDirectory()

AndroidExternalStorage.getExternalStoragePublicDirectory() needs Public Directory Type argument same as native getExternalStoragePublicDirectory().

DirTypeAndroid Native
DirType.musicDirectoryEnvironment.DIRECTORY_MUSIC
DirType.podcastDirectoryEnvironment.DIRECTORY_PODCASTS
DirType.ringtoneDirectoryEnvironment.DIRECTORY_RINGTONES
DirType.alarmDirectoryEnvironment.DIRECTORY_ALARMS
DirType.notificationsDirectoryEnvironment.DIRECTORY_NOTIFICATIONS
DirType.picturesDirectoryEnvironment.DIRECTORY_PICTURES
DirType.moviesDirectoryEnvironment.DIRECTORY_MOVIES
DirType.downloadDirectoryEnvironment.DIRECTORY_DOWNLOADS
DirType.DCIMDirectoryEnvironment.DIRECTORY_DCIM
DirType.documentsDirectoryEnvironment.DIRECTORY_DOCUMENTS
DirType.screenshotsDirectoryEnvironment.DIRECTORY_SCREENSHOTS
DirType.audioBooksDirectoryEnvironment.DIRECTORY_AUDIOBOOKS

Example

void _example1() async {
  var path = await AndroidExternalStorage.getExternalStorageDirectory();
  print(path);  // /storage/emulated/0
}

void _example2() async {
  var path = await AndroidExternalStorage.getExternalStoragePublicDirectory(DirType.picturesDirectory);
  print(path);  // /storage/emulated/0/Pictures
}

void _example3()async{
  var path = await AndroidExternalStorage.getRootDirectory();
  print(path);  // /system
}

Author

sam garg

LICENCE

MIT LICENCE

Based on https://pub.dev/packages/ext_storage.

Libraries

android_external_storage