PlatformFile. Most targets need no setup beyond the dependency.
Installation
FileKit can helps you to display dialogs to the user like file, directory and photo pickers, save dialogs, camera and more. FileKit dialogs are available in two flavors:filekit-core. Check the platform support matrix for the dialogs available on each target.
Android setup
Only Android needs an init step for dialogs, and only when you call the suspend APIs (FileKit.openFilePicker()…). Compose launchers register the activity for you, but a suspend call made before any launcher is composed throws FileKitNotInitializedException. Register your activity so FileKit can reach its ActivityResultRegistry:
MainActivity.kt
filekit-dialogs-compose, the launchers find the registry themselves. On JVM, Linux native, and Windows native, FileKit.init(appId) is not needed for dialogs: it only configures app directories such as filesDir and cacheDir. See Core setup.
Linux setup
- JVM on Linux
- Linux native
Packaged Compose Desktop apps need the Dialogs use the XDG Desktop Portal when it is running and fall back to AWT/Swing dialogs otherwise.
jdk.security.auth module, otherwise dialogs can fail with a NoClassDefFoundError (issue #107):build.gradle.kts
Compose launchers
remember…Launcher functions capture platform context when they are remembered, not when you call launch(). A few platforms care about where that happens.
main.kt
ProGuard
If you shrink or obfuscate your JVM app, add the JNA and D-Bus keep rules from Core setup.Related
- File picker to open your first dialog.
- Results and errors for cancellation and failure handling.