Expose Results as Flow
Stream repository data to both UIs reactively.
Beyond One-Shot Calls
A suspend function returns once, but real screens want updates over time. That is exactly what Flow gives you.
Return a Flow
Change the repository to return a Flow of your domain type, so callers can react to a stream of results.
fun observeUsers(): Flow<List<User>>All lessons in this course
- Define a Repository Interface
- Wrap the API Behind the Repository
- Map DTOs to Domain Models
- Expose Results as Flow