LazyAsyncValue

interface LazyAsyncValue<out T>

A value that is produced asynchronously and cached after first initialized.

Similar to Lazy<T> but supports asynchronous initialization. Implementations MUST be thread safe.

NOTE: Properties cannot be loaded asynchronously so unlike Lazy<T> a LazyAsyncValue<T> cannot be a property delegate.

Functions

Link copied to clipboard
abstract suspend fun get(): T

Get the cached value or initialize it for the first time. Subsequent calls will return the same value.