Menu

1 / 2

New ImagePickerKMP API: The easiest way to handle Camera and Gallery in Kotlin Multiplatform

DEV Community·Ismoy Belizaire·6 months ago
#Jo0s4oL8
#ai#opensource#kotlin#mobile#handling
Reading 0:00
15s threshold

Handling camera and gallery in Kotlin Multiplatform has always been difficult.

Different APIs for Android and iOS.

Permissions everywhere.

State management with booleans like showCamera and showGallery.

This changes with the new API introduced in ImagePickerKMP, which provides a cleaner, reactive, and truly multiplatform approach.

The problem with current solutions

If you have worked with KMP and media input, you have likely faced:

Platform-specific implementations

Complex permission flows

UI inconsistencies between Android and iOS

State handling with multiple flags (showCamera, showGallery, etc.)

Most existing solutions are also not designed with Compose Multiplatform as a first-class approach.

Introducing the new API: rememberImagePickerKMP

The new recommended API is:

kotlin val picker = rememberImagePickerKMP(...)

This API provides a state-driven approach that controls the entire flow.

It returns an ImagePickerKMPState, which:

Handles camera and gallery

Exposes a reactive…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.