The below code give me the desired result,by fetching the data from firestore using coroutine flow.
suspend fun getFeedPer() = flow<State<Any>> {
emit(State.loading())
val snapshot = dbRef.collection("FeedInfo/FeedPercent/DOC/")
.whereGreaterThanOrEqualTo("bodyWeight", 0.80)
.limit(1)
.get().await()
val post = snapshot.toObjects(FeedPer::class.java)
Log.d("TAG", "getFeedPer: ${snapshot.documents[0].id}")
Log.d("TAG", "getFeedPer: $post")
emit(State.success(post))
}.catch {
emit(State.failed(it.message.toString()))
}.flowOn(Dispatchers.IO)
Now i am trying to add one more filter to my query. For that i am using task.
val docRef=dbRef.collection("FeedInfo/FeedPercent/DOC/")
val task1=docRef.whereGreaterThanOrEqualTo("bodyWeight", 0.80)
.limit(1).get()
val task2=docRef.whereLessThanOrEqualTo("bodyWeight", 0.80)
.limit(1).get()
now how to get it done with coroutine flow.
Please help Thanks