Florian
suspend fun
suspend fun getChatUserFlow(uid: String): Flow<ChatUser?> { val results = userCollection.whereEqualTo(FieldPath.documentId(), uid).get().await() return if (!results.isEmpty) { results.documents[0].reference.asFlow<ChatUser>() } else { flowOf(null) } }
fun getChatUserFlow(uid: String): Flow<ChatUser?> = userCollection.whereEqualTo(FieldPath.documentId(), uid).asFlow<ChatUser>().flatMapLatest { result -> if (!result.isEmpty()) { userCollection.document(result[0].uid!!).asFlow() } else { flowOf(null) } }
gildor
A modern programming language that makes developers happier.