Peter
12/01/2023, 1:38 PMsuspend
, until lateinit var
is initialized?CLOVIS
12/01/2023, 1:46 PMlateinit var foo: String
suspend fun await(): String {
while (isActive) {
if (this::foo.isInitialized)
return foo
delay(10)
}
}
CLOVIS
12/01/2023, 1:48 PMlateinit var
by a CompletableDeferred
, but I don't think there is an API to check if it has finished yet?
Something like
class Foo(
scope: CoroutineScope
) {
val foo = scope.async {
…
}
}
and now you can foo.foo.await()
.Peter
12/01/2023, 1:52 PMabstract class X @Inject constructor() {
@Inject
lateinit var y: Y
}
Klitos Kyriacou
12/01/2023, 3:22 PM