Closed Goooler closed 1 year ago
Hello! Along with moving Opto’s source code to this organization and republishing it under a new group ID, I have rewritten the library and slimmed it down. We’d like to keep Opto relatively light, and functions such as firstBlocking
or onEach
were minimally beneficial (and, to a certain degree, out of the scope of the project). With that said, since they are extension functions, you can restore them by adding them to your code base:
fun <T> Preference<T>.firstBlocking() = runBlocking { get().first() }
fun <T> Preference<T>.onEach(launchIn: CoroutineScope, block: suspend (T) -> Unit) {
get().onEach(block).launchIn(launchIn)
}
Below is state
(from the compose
module). This has been removed both for the reason described above and because it’d be architecturally preferable not to expose Preference
to composables, mixing UI and business logic.
@Composable
fun <T> Preference<T>.state(initial: T? = null) = get().collectAsState(initial)
Can't migrate from
And the compose module is missing?