directory_picker 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 88

Directory Picker #


A flutter package to pick directories and handles requesting required permissions as well. This package only supports android.

Picker Screenshot

Installation #

Add below line to your pubspec.yaml and run flutter packages get

directory_picker: ^1.0.0

NOTE: As of version 1.0.0 this plugin switched to the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project is also upgraded to support AndroidX. Detailed instructions can be found here. Use version 0.2.2 if you do not want to use AndroidX(not recommended) for your project.

The TL;DR version is:

  1. Add the following to your "" file:
  1. Make sure you set the compileSdkVersion in your "android/app/build.gradle" file to 28:
android {
 compileSdkVersion 28

  1. Make sure you replace all the android. dependencies to their AndroidX counterparts (a full list can be found here:

Permissions #

Add below line to your android/app/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

If you want to allow creating new folders directly from picker then add the below permission also

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Usage #

import 'package:directory_picker/directory_picker.dart';
import 'package:path_provider/path_provider.dart';

// In any callback call the below method 
Directory newaDirectory = await DirectoryPicker.pick(
  context: context,
  rootDirectory: directory

if (newDirectory != null) {
  // Do something with the picked directory
} else {
  // User cancelled without picking any directory

See example app for more detailed usage.


  • [ ] Make rootDirectory optional.
  • [ ] Better levels of customisation for picker dialog.


  • Migrated to AndroidX.
  • Changed permission handling plugin from simple_permissions to permissions_handler.


  • Fixes a bug with permission handling.


  • Added a missing dependency to pubspec.yaml.


  • Now new folders can be created directly from directory picker. Enable it by passing allowFolderCreation = true to the picker.


  • Fixes typo in README
  • Code formatted and version bump to release.


  • Adds initial version of directory_picker


Directory Picker Example #

This example shows how to use directory_picker plugin.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  directory_picker: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:directory_picker/directory_picker.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Fix lib/directory_picker.dart. (-0.50 points)

Analysis of lib/directory_picker.dart reported 1 hint:

line 69 col 20: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (permission_handler).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
path ^1.6.2 1.6.4
permission_handler ^3.2.2 3.3.0 4.2.0+hotfix.2
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies