icerockdev / moko-mvvm

Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
995 stars 95 forks source link

LiveData.flatMapBuffered should pass in lambda optional current at initialization #112

Open Alex009 opened 3 years ago

Alex009 commented 3 years ago

With this code:

val input: MutableLiveData<Int> = MutableLiveData(initialValue = 2)
val output: LiveData<String> = input.flatMapBuffered { current, new ->
    MutableLiveData("$current:$new")
}

we now got output after initialization with value 2:2 and it can be invalid - we have only 1 value in real, so we should pass in current null and in new - initial value. null:2 should be i think