What is LiveData vs StateFlow?

Updated Feb 20, 2026

Short answer

LiveData is lifecycle-aware observable, while StateFlow is a Kotlin Flow for reactive state handling.

Deep explanation

🔹 LiveData

  • Lifecycle aware
  • Android-specific

🔹 StateFlow

  • Kotlin-based
  • Better for modern apps

---

🖼️

Markdown
![StateFlow vs LiveData](https://developer.android.com/static/topic/libraries/architecture/images/livedata-flow.png)

---

🔹 Modern Trend

  • StateFlow preferred in Compose apps

Real-world example

Real-time chat updates using StateFlow.

Common mistakes

  • Using LiveData in Compose incorrectly

Follow-up questions

  • Flow vs StateFlow?

More Android interview questions

View all →