null), and an operational failure (a FileKitDialogException). Invalid arguments and unexpected defects are never converted into failures: they propagate as the original exception.
Compose launchers
Use the launcher overloads that takeonError. The trailing lambda is onResult:
rememberFilePickerLauncher passes a FileKitPickerException (the picker subtype of FileKitDialogException) to onError. The directory picker, file saver, camera, and share launchers pass a FileKitDialogException.
If a dialog never appears on iOS, check where the launcher is remembered: see Compose launchers.
Suspend API
TheFileKit.open⦠functions return null when the user cancels and throw on operational failures:
maxItems outside 1..50) propagate as usual. Catch FileKitDialogException to handle every dialog failure in one place.
State-tracking picker modes
FileKitMode.SingleWithState and MultipleWithState deliver progress and their terminal outcome as FileKitPickerState values, through onResult in Compose or the returned Flow in the suspend API:
StartedandProgressare non-terminal values.- Exactly one of
Completed,Cancelled, orFailedis the terminal value. FileKitPickerState.Failedis data: it is not duplicated throughonError.- A picker failure thrown outside the state stream reaches
onError(or is thrown while collecting the flow). - Coroutine cancellation stops delivery and produces no later terminal value.
Sharing
Sharing has no success callback. A successful share launch, including user dismissal after the system share sheet appears, stays callback-less. A FileKit-owned operational failure reachesonError. Coroutine cancellation, invalid invocations, unexpected defects, and callback exceptions propagate.
Compatibility overloads
Launcher overloads withoutonError remain available for source and binary compatibility. They keep their historical callback shape and ignore operational failures without logging. They still propagate coroutine cancellation, invalid invocations, unexpected defects, and exceptions thrown by your callbacks.
Prefer the onError overloads in new code so failures are visible.
Related
- File picker for picking modes, including state tracking.
- Dialogs setup for where to remember launchers.