ext_storage

ext_storage is minimal flutter plugin that provides external storage path and external public storage path.

Features

NOTE This plugin is only supported Android.

ExtStorage package calls Android native code, Environment.getExternalStorageDirectory() and Environment.getExternalStoragePublicDirectory().

ExtStorageAndorid Native
ExtStorage.getExternalStorageDirectory()Environment.getExternalStorageDirectory()
ExtStorage.getExternalStoragePublicDirectory()Environment.getExternalStoragePublicDirectory()

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

ExtStorageAndroid Native
ExtStorage.DIRECTORY_MUSICEnvironment.DIRECTORY_MUSIC
ExtStorage.DIRECTORY_PODCASTSEnvironment.DIRECTORY_PODCASTS
ExtStorage.DIRECTORY_RINGTONESEnvironment.DIRECTORY_RINGTONES
ExtStorage.DIRECTORY_ALARMSEnvironment.DIRECTORY_ALARMS
ExtStorage.DIRECTORY_NOTIFICATIONSEnvironment.DIRECTORY_NOTIFICATIONS
ExtStorage.DIRECTORY_PICTURESEnvironment.DIRECTORY_PICTURES
ExtStorage.DIRECTORY_MOVIESEnvironment.DIRECTORY_MOVIES
ExtStorage.DIRECTORY_DOWNLOADSEnvironment.DIRECTORY_DOWNLOADS
ExtStorage.DIRECTORY_DCIMEnvironment.DIRECTORY_DCIM
ExtStorage.DIRECTORY_DOCUMENTSEnvironment.DIRECTORY_DOCUMENTS

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

Libraries

ext_storage