CallbackFlow waiting for its inner flow to be collected
I'm implementing firestore in my android app and I was wondering how I can make this code wait for its inner flow to be collected before running with the program. The trip.tripDays in the when expression is getting populated with data a time after Response.Success with my trips is already sent.
override fun getTrips(idUser: String): Flow = callbackFlow {
val trips = mutableListOf()
tripsRef
.whereEqualTo(ID_USER, idUser)
.get()...