You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into a minor annoyance when trying to combine StateFlows because all of the operators for StateFlow return Flow. This is solved at the moment by casting all of my operations back to StateFlow but it would be nice if I didn't have to do a cast every time.
val test1 = MutableStateFlow(1)
val test2 = MutableStateFlow(2)
val test3: StateFlow<Int> = test1.map { it * 2 } as StateFlow<Int>
val test4: StateFlow<Int> = test1.combine(test2) { first, second -> first + second } as StateFlow<Int>
The text was updated successfully, but these errors were encountered:
I'm running into a minor annoyance when trying to combine StateFlows because all of the operators for StateFlow return Flow. This is solved at the moment by casting all of my operations back to StateFlow but it would be nice if I didn't have to do a cast every time.
The text was updated successfully, but these errors were encountered: