When using MutableLiveData works
# coroutines
j
When using MutableLiveData works
g
could you show some code example
j
message has been deleted
this
copy()
is unnecessary there, but to show
In mode debug i see alert in collect of method fetchCurrentUser(), but donot emit
g
Let’s start from beginning, your original question mentioned live data, but it looks that not whole code is here
It’s hard to say what you expect and where it broken
I also don’t see MutableStateFlow
it’s not really related to you problem, but overal approach looks incorrect for me, why use shared mutable state (MutableLiveData/MutableStateFlow) to expose this state insted just mapping to original flow?
j
Sorry
g
are you sure that you call fetchCurrentUser?
have you tried to debug it (just print logs what is called)
j
I'm debugged via breakpoints, in collect enter, but in "emit" of asLivedata no (i'm copy the code of this function to test)
Yeah, the fetchCurrentUser is called
g
ah, with breakpoints it can be quite tricky
so what is your result?
j
message has been deleted
Debug via print there
is emitted more often because getCurrentUser is used elsewhere
message has been deleted
value of mutableStateFlow is detected as equal to new value (it), but is not equal, the value of property
nome
is
jsnsn
because the
emit
is not called
@gildor understood the problem that is occurring?
g
value and it have the same hashcode, so looks as incorrect equals/hashcode implementation, if some values insdide are different
also in debug but has the same value in
nome
as I see on screenshot
try to print $it in collected in fetchjCurrentUser log
but according to debug those have the same content (at least from what I see on screenshot)
j
Yeah, but this update of value is not emitted
g
but does value is actually different?
because on your screenshot it’s the same
j
The problem is on the change of data, i'm are changing with apply the coming from .value 🤦🏻‍♂️
Thanks @gildor
👍 1