File and directory picker for Windows that uses common dialog controls.
This package builds on top of the package:win32 and provides a high-level abstraction over native file picker APIs. It eliminates the need to work directly with FFI, raw pointers, or low-level Win32 calls while preserving performance and correctness.
β¨ Features
- π Open a single file or multiple files simultaneously
- πΎ Save a file
- π Select a directory
- π Filter by file type with friendly display names
- π Add custom places to the dialog's navigation pane
- πͺ Pin to the correct window β always opens as a modal in front of your app
π Getting Started
Add the package to your pubspec.yaml:
dependencies:
filepicker_windows: ^3.0.1
Then import it:
import 'package:filepicker_windows/filepicker_windows.dart';
β‘ Quick Example
Show a file open dialog:
import 'package:filepicker_windows/filepicker_windows.dart';
void main() {
final picker = OpenFilePicker()
..filterSpecification = {
'Word Document (*.doc)': '*.doc',
'Web Page (*.htm; *.html)': '*.htm;*.html',
'Text Document (*.txt)': '*.txt',
'All Files': '*.*',
}
..defaultFilterIndex = 0
..defaultExtension = 'doc'
..title = 'Select a document';
final file = picker.getFile();
if (file != null) {
print('Selected file: ${file.path}');
} else {
print('No file selected.');
}
}
More examples β including multi-file selection, save dialogs, directory picking, and custom places β are available in the example directory.
For a more advanced demonstration, see example/wallpaper/, a Flutter app
that uses the picker to select an image and set it as the desktop wallpaper.
π Documentation
Full API reference is available here:
π API Reference.
Additional usage examples are located in the example directory.
π Features and Bugs
If you encounter bugs or need additional functionality, please file an issue.
Libraries
- filepicker_windows
- File and directory picker for Windows that uses common dialog controls.