Kotlin Flows, StateFlow, and SharedFlow: When to Use What in Android? 

Explore the different types of Kotlin Flows used in Android. Flow, StateFlow and SharedFlow have similar sets of operators and terminals but they are very different in their behaviour. With the help of a simple Jetpack compose-based app, we will understand the differences between these Flows and explore the best practices to implement them. The application will be based on Google's recommended architecture where responsibility will be divided between UI, Domain and Data layer. 

In this coffee break codelab, you'll explore:
  • The fundamentals of Kotlin Flow and its types 
  • The idea is to clarify the difference between Flow, StateFlow and SharedFlow 
  • Understand the concept of buffer and replay cache with SharedFlow

Meet the instructor

Hardik Trivedi

Content Author & Course Instructor

More courses by the instructor