Hi! Can anybody tell me how to deal with `Flow` in...
# room
m
Hi! Can anybody tell me how to deal with
Flow
in Room? Easy queries works fine, but what if I wan’t to use more extended like:
Copy code
@Query("SELECT id, (SELECT COUNT(id) FROM `message` WHERE channelId = channel.id and timestamp > channel.custom_readAt) as `unreadCount` FROM `channel`")
fun getAll(): Flow<List<UnreadMessageData>>
the new value is not emited. But in DatabaseInspector with ‘live update’ enabled it works fine. Any ideas?
Interesting thing:
Copy code
@Query("SELECT COUNT(id) FROM `message` WHERE channelId = :channelId")
    fun getUnread(channelId: String): Flow<Int>
Is not working too.
That looks more complicated. Same story with
@DatabaseView
, does anyone knows if it’s working with flow?
Ok, looks like a DAOs without
insert
is not creating an event adapter. So the only workaround now is to listen on different DAO and map later.