Код: Выделить всё
suspend fun addOverallRatingValue(productId: String): Flow
suspend fun markProductAsRatedByUser(productId: String): Flow
Код: Выделить всё
override suspend fun markProductAsRatedByUser(productId: String) = callbackFlow {
try {
firebaseInstance
...
.addOnSuccessListener {
trySend(FirebaseEventResponse.SuccessSetValue)
}
.addOnFailureListener {
trySend(FirebaseEventResponse.ExceptionOccurred.Event(it))
}
} catch (e: Exception) {
trySend(FirebaseEventResponse.ExceptionOccurred.Event(e))
}
awaitClose { this.cancel() }
}
Подробнее здесь: https://stackoverflow.com/questions/721 ... uced-value