Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What is the difference between StateFlow and LiveData?

  1. A StateFlow is not lifecycle-aware by itself and must be collected within repeatOnLifecycle
  2. B LiveData is not lifecycle-aware
  3. C StateFlow cannot hold a current value
  4. D They are identical
Answer

StateFlow is not lifecycle-aware by itself and must be collected within repeatOnLifecycle

Without repeatOnLifecycle or collectAsStateWithLifecycle, collection continues while the app is backgrounded, wasting work.

All Android MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as