Package: filepicker_windows Publisher: halildurmus.dev Language: Dart License: BSD-3-Clause

A package that provides a friendly Dart API for file and directory selection for Windows using common dialog controls.

This package builds on top of the Dart win32 package, offering a high-level Dart wrapper that avoids the need for users to understand FFI or write directly to the Win32 API.

Usage

File Picker

Show a file picker dialog, allowing the user to select a file.

import 'package:filepicker_windows/filepicker_windows.dart';

void main() {
  final file = 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 result = file.getFile();
  if (result != null) {
    print(result.path);
  }
}

Directory Picker

Show a directory picker dialog, allowing the user to select a directory.

import 'package:filepicker_windows/filepicker_windows.dart';

void main() {
  final file = DirectoryPicker()..title = 'Select a directory';

  final result = file.getDirectory();
  if (result != null) {
    print(result.path);
  }
}

Additional examples can be located within the example\ directory.

For a more advanced demonstration, you can explore a Flutter application in the example\wallpaper\ directory. This application illustrates how to select an image file and set it as your desktop wallpaper.

Feature requests and bugs

Please file feature requests and bugs at the issue tracker.

Libraries

filepicker_windows
A Dart library that allows file and directory selection for Windows using common dialog controls.