Is there some sort of `dispatch_once` in the Kotli...
# coroutines
a
Is there some sort of
dispatch_once
in the Kotlin Coroutine world?
m
What do you mean?
a
dispatch_once is basically used to create singetons, right?
a
I guess I’m looking for a compact way of doing
Copy code
val someSetupJob by lazy {
    async {
        // do some complex initialization
    }
}
a
you can do that with the object keyword
val myLazyValue = async(start = CoroutineStart.LAZY) { ... }
. Use
myLazyValue.await()
when you need it
a
That’s great @antonis thank you!
a
@Alessandro Diaferia I never actually faced this issue, so thank you for asking 🙂