DAOs & Flow queries

A Flow that re-emits itself

Module 13 taught you stateIn for turning a cold, polling Flow into something a screen can collect for free. Room queries skip the polling entirely: a @Query DAO method that returns Flow<List<WalkEntity>> re-emits a brand-new list automatically every time the underlying table changes β€” no delay(30_000) loop, no manual refresh call. Room watches the table for you and re-runs the query the instant an insert, update, or delete touches it.

That's what makes Room plug straight into the reactive pattern you already know: dao.observeAll() returns a Flow, the repository exposes it (or wraps it in stateIn), and the UI collects it with collectAsState(). Write to the table from anywhere, and every screen watching it updates itself.