Greetings all! Is it possible that a `LiveData` wi...
# android
m
Greetings all! Is it possible that a
LiveData
with a backing property (MutableLiveData) inside the ViewModel to
Observe
and
Add
to an ArrayList can cause a race condition and a
Lock
is required? Provided that the ArrayList will get its value from a callback.
d
Uh, with the simple setup you've described, no it won't cause a race condition. Observers are called on the singular main thread.
m
Here is my exact question if anyone would like to answer: https://stackoverflow.com/questions/66837683/race-condition-with-livedata
I'm not sure if posting links is allowed, kindly tell me if it's against the rules I'll delete it 🙂
d
It's cool. 😄