easy_folder_picker 1.3.4 copy "easy_folder_picker: ^1.3.4" to clipboard
easy_folder_picker: ^1.3.4 copied to clipboard

Easy directory picker for Flutter, you can choose directory or create directory for further action

Easy Folder Picker #

Easy directory picker for Flutter

pub

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

Picker Screenshot1 Picker Screenshot2

Installation #

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

  easy_folder_picker: ^latest version
copied to clipboard

Permissions #

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

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

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" />
copied to clipboard

Android 10 (Q) #

In Android 10, you need to add the Following Lines in AndroidManifest file:

<application
      android:requestLegacyExternalStorage="true"
copied to clipboard

Android 11 #

From Android 11, you need to manage permission within your app, if you want to write in different folders of external storage.

Steps

  1. Add the following Lines in AndroidManifest file
  <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
copied to clipboard
  1. Add device_info package to check android version
  2. Check permission if app can manage external storage if its android 11 or greater Note: This is a runtime permission (might not show it in app info's permission section )
  var status = await Permission.manageExternalStorage.status;
      if (status!.isRestricted) {
        status = await Permission.manageExternalStorage.request();
      }

      if (status!.isDenied) {
        status = await Permission.manageExternalStorage.request();
      }
      if (status!.isPermanentlyDenied) {
        ScaffoldMessenger.of(context).showSnackBar(SnackBar(
          backgroundColor: Colors.green,
          content: Text('Please add permission for app to manage external storage'),
        ));
      }
copied to clipboard

Flutter Usage #

import 'package:easy_folder_picker/FolderPicker.dart';

// In any callback call the below method
  Future<void> _pickDirectory(BuildContext context) async {
    Directory directory = selectedDirectory;
    if (directory == null) {
      directory = Directory(FolderPicker.ROOTPATH);
    }

    Directory newDirectory = await FolderPicker.pick(
        allowFolderCreation: true,
        context: context,
        rootDirectory: directory,
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(10))));
    setState(() {
      selectedDirectory = newDirectory;
      print(selectedDirectory);
    });
  }
copied to clipboard
34
likes
150
points
210
downloads

Publisher

verified publisherkapil.info.np

Weekly Downloads

2024.09.26 - 2025.04.10

Easy directory picker for Flutter, you can choose directory or create directory for further action

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, path, permission_handler

More

Packages that depend on easy_folder_picker