Does anyone understand why this is considered inva...
# coroutines
Does anyone understand why this is considered invalid? If I am instantiating this object within the scope of a suspended function, then this should be supported correct? Or are property getters not allowed to execute suspended code for some reason?
created 6 years ago
ty, I will find a different way
You'll need to do the suspending bit in the
function body directly then capture the result in anonymous object.
instantiating an object in a suspend function doesn't automatically make its function or property getter calls suspend (why should it?), the real question is why
has to be a suspend function? it's just creating an object, no suspend functions are being called so just make it a regular function
suspend property getters aren't supported by Kotlin
the coding conventions state that properties should be ‚Äúcheap to calculate‚ÄĚ and I would go even further and say, they should only contain trivial calculations.
Suspend does not really fit well with this idea of properties.