OpenFilePicker

fun EventSchemaBuilderScope.OpenFilePicker(id: String = randomId(), trigger: EventTrigger, fileType: OpenFilePickerEventSchema.FileType, pickMode: OpenFilePickerEventSchema.PickMode = singlePickMode(), events: EventSchemaBuilderScope.() -> Unit = {}, outputType: FileOutputType = platformFile())

Opens the platform file picker and emits the chosen file downstream, shaped by outputType. fileType restricts what can be picked; pickMode currently only offers a single selection. Does not consume incomingData. Dispatches onSuccess (carrying the content, shaped by outputType) when a file was picked and read; onCancelled (no data) when the user dismisses the picker without choosing a file; onFailure (carrying the thrown exception) when mapObject() decoding fails or the picker itself throws.

Parameters

id

Unique identifier of this event. Defaults to a random id.

trigger

Trigger that fires this event, built via EventTriggers.

fileType

Kinds of files selectable in the picker — imageFileType, videoFileType, imageAndVideoFileType or fileFileType.

pickMode

Selection mode — currently only singlePickMode. Defaults to single.

events

Child events chained after this one, wired to its triggers (onSuccess, onCancelled, onFailure).

outputType

Shape of the content delivered as incomingData — platformFile, arrayOfBytes, flowOfBytes, mapObject or base64. Defaults to the platform file handle.