PromptModel
Base model object for prompts.
Prompt is a UI dialog (typically a modal bottom sheet dialog) that asynchronous code can pop up merely by calling a specialized function like requestPassphrase. Such function will show the dialog, and then suspend until user enters the input, performs the required action or dismisses the dialog. User input is then returned to the caller (or PromptDismissedException is thrown if the dialog is dismissed).
PromptModel must exist in the current coroutineContext for prompt functions to work.
An instance of PromptModel can be added to the context using withContext.
There is a predefined coroutine scope promptModelScope that is bound to the context that contains this model (it can be used similar to
ViewModel.viewModelScope
on Android).In Composable environment PromptModel can be used with
rememberCoroutineScope
like this:val myScope = rememberCoroutineScope { promptModel }
Content copied to clipboard
PromptModel provides individual model objects for each supported prompt type. Each platform has its own set. passphrasePromptModel is the only prompt type that must exist on every platform.