How can I emit emptyFlow when result is null? I h...
# flow
b
How can I emit emptyFlow when result is null? I have this piece of code :
Copy code
dao.get(areaAccountingId = areaAccountingId, assetId = assetId)
.filterNotNull()
.map {
     it.toDomainModel()
}.onEmpty {  }
I want onEmpty to get triggered but it doesn't
j
are you getting a list of things?
b
nope its just single item
b
Dao (if it's room) generates infinity flow. To take only one value add
.take(1)
before filter