macos_file_picker 0.1.1 copy "macos_file_picker: ^0.1.1" to clipboard
macos_file_picker: ^0.1.1 copied to clipboard

Opens native macOS dialogs to pick files or folders.

pub package

Opens native macOS dialogs to pick files or folders. Features:

  • Pick a single or multiple files, folders and both.
  • Pick a file to save.

Usage #

///
/// Open a macOS dialog based on the given arguments.
///
/// [mode]:
///   file: pick files.
///   folder: pick folders.
///   fileAndFolder: pick files and folders.
///   saveFile: pick a file saving path.
///
/// [allowsMultiple] when true, allows multiple selection.
/// [defaultName] default file name for save dialog.
///
/// Return value:
///   null: dialog closed / cancelled.
///   When [allowsMultiple] is false, the list returned only has one item.
Future<List<String>?> pick(MacosFilePickerMode mode,
    {String? defaultName, bool? allowsMultiple});

Example #

final _macosFilePickerPlugin = MacosFilePicker();

Future<void> _openDialog() async {
  // Pick a single file path.
  var result = await _macosFilePickerPlugin.pick(_mode,
      allowsMultiple: _allowsMultiple);
  setState(() {
    _output = result == null ? 'Cancelled' : result.first;
  });
}
0
likes
0
points
197
downloads

Publisher

verified publisherflutter-cavalry.com

Weekly Downloads

Opens native macOS dialogs to pick files or folders.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on macos_file_picker