fc_file_picker_util 0.7.0 copy "fc_file_picker_util: ^0.7.0" to clipboard
fc_file_picker_util: ^0.7.0 copied to clipboard

discontinuedreplaced by: fast_file_picker

File pickers based on file_selector.

fc_file_picker_util #

pub package

Windows macOS iOS Android
Pick files ✅ (Path) ✅ (Path/URL) ✅ (Path/URL) ✅ (Uri)
Pick a folder ✅ (Path) ✅ (Path/URL) ✅ (Path/URL) ✅ (Uri)
Pick a save path ✅ (Path) ✅ (Path/URL)

fc_file_picker_util is based on file_selector with the following differences:

  • On iOS and macOS, it returns both URL and path for files and folders.
  • On Android:
    • Files: instead of copying the file to a temporary location, it returns an SAF Uri.
    • Folders: it returns an SAF Uri.
    • To access the Uri-based file or folder, use my other packages: saf_stream and saf_util.
  • On Windows, it returns the path for files and folders.

Usage #

macOS #

You need to add the following key to entitlements in order for macOS app to be able to access file system:

  <key>com.apple.security.files.user-selected.read-write</key>
  <true/>

FcFilePickerPath #

Since fc_file_picker_util can return path or URI or both, the result is wrapped in FcFilePickerPath:

class FcFilePickerPath {
  final String? path;
  final String? uri;
}

Pick a file or multiple files #

/// Picks a file and return a [FcFilePickerPath].
final file = await FcFilePickerUtil.pickFile();

/// Picks multiple files and return a list of [FcFilePickerPath].
final files = await FcFilePickerUtil.pickMultipleFiles();

Pick a folder #

/// Picks a folder and return a [FcFilePickerPath].
///
/// [writePermission] is only applicable on Android.
final folder = await FcFilePickerUtil.pickFolder(writePermission: true);

Pick a save path #

It's recommended to use mobile share menu to save files.

/// Picks a save file location and return a [String] path.
/// You can optionally specify a default file name via [defaultName].
final savePath = await FcFilePickerUtil.pickSaveFile();