yschimke
12/03/2021, 12:06 PMsuspend fun getX() : X
fun getXFlow(): Flow<X>
val a = getX()
val b = getXFlow().first()
Obviously the implementations may be different (one off query vs query and subscribe). But can the implementation optimise the call to first() which is the when the subscription happens and short circuit it? Othewise it's tempting to put both variants on most repository methods. But it would be nice if there was an expectation that first() should optimise to the suspend fun case.Adam Powell
12/03/2021, 2:40 PMyschimke
12/03/2021, 6:13 PMpublic suspend fun <T> Flow<T>.first(): T {