Reactive Queries Returning Flow
Observe the database in Compose.
Static Reads Go Stale
A one-time query gives you data once, but the table keeps changing. You want the UI to refresh whenever rows are added or removed.
Return a Flow Instead
Change a DAO query to return a Flow. Room now emits a fresh list every single time the underlying table changes. 🔄
@Query("SELECT * FROM Note")
fun observeAll(): Flow<List<Note>>All lessons in this course
- Entities, DAOs & the Database
- Reactive Queries Returning Flow
- The Repository Pattern
- Offline-First Caching Strategy