hfhbd
08/30/2021, 6:57 PMdao.get().collectAsState(emptyList())
with interface Dao { @Query(...) fun get(): Flow }
? You have to use a ViewModel to get updates on DB changes. WA: wrap the collect
in VM and emit them to the flow accessed by Compose...Albert Chang
08/31/2021, 12:05 AMdao.get()
is a function, which means every time it is called you get a new flow, and it will be called on every recomposition. If you really want to use it directly in a composable function, you should use remember { dao.get() }.collectAsState(emptyList())
.hfhbd
08/31/2021, 7:38 AM