This is a demo Android project showing best practices for data loading using:
- ViewModel
- Kotlin Flow
- Repository Pattern
- Hilt Dependency Injection
- Room Database
- Retrofit API
- Jetpack Compose UI
-
Clone the repository:
git clone https://github.com/anilkumar2681/Kotlin-Flow-Demo-Master.git
-
Open in Android Studio (Arctic Fox or newer).
-
Run on emulator/device.
The app will fetch users from https://json-placeholder.mock.beeceptor.com/users, cache them into Room DB, and display them with Jetpack Compose.
UI (Jetpack Compose) <-> ViewModel <-> Repository <-> (Room DB + Retrofit API)
| Loading State | Success State | Error State |
|---|---|---|
![]() |
![]() |
![]() |
UiStatefor handling Loading/Success/ErrorStateFlowin ViewModel for UI state exposure- Repository pattern for clean separation
- Offline-first approach (cache → network)
Made with ❤️ using Kotlin + Jetpack Compose
Get Kotlin & Android Jetpack Compose tips on What's App Join My Channel :
📚 Kotlin & Android Learning📚




