Questions
KotlinIntermediate4 min
What is Unidirectional Flow?
Answer
Unidirectional Data Flow (UDF) is a design pattern where data flows in only one direction.
The Cycle
- State: Flows down from the ViewModel to the UI.
- Events: Flow up from the UI to the ViewModel (user actions).
- Mutation: The ViewModel processes the event and updates the State.
Benefits
- Predictability: State is only changed in one place.
- Debuggability: Easy to trace where data changed.
- Testability: UI and Logic are decoupled.
Commonly implemented using `StateFlow` or `LiveData`.
1:1 Mentorship
Get personalized guidance from a Google Developer Expert. Accelerate your career with dedicated support.
Personalized Learning Path
Mock Interviews & Feedback
Resume & Career Guidance
Share & Help Others
Help fellow developers prepare for interviews
Sharing helps the Android community grow 💚