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 }

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.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
abstract val promptModelScope: CoroutineScope

Functions

Link copied to clipboard
open override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
Link copied to clipboard
open operator override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
Link copied to clipboard
open override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
Link copied to clipboard
open operator fun plus(context: CoroutineContext): CoroutineContext