Zach Klippenstein (he/him) [MOD]
06/04/2020, 4:51 PMFlow operators for StateFlow that preserve the value property? I filed an issue for map here, curious if people have other use cases or use cases for other operators (or opinions about this proposal).
https://github.com/Kotlin/kotlinx.coroutines/issues/2081streetsofboston
06/04/2020, 5:09 PMmap, but it wouldn’t work for filter for example….streetsofboston
06/04/2020, 5:10 PMmap a Processor/Subject returns an Observable (or Flowable)Zach Klippenstein (he/him) [MOD]
06/04/2020, 5:15 PMZach Klippenstein (he/him) [MOD]
06/04/2020, 5:16 PMSubject isn’t a read-only type, and isn’t suitable for exposing as such.Zach Klippenstein (he/him) [MOD]
06/04/2020, 5:17 PMWhy hot hold a second reference, a reference to the original StateFlow?I’m not sure what you mean. For my use case, the underlying
StateFlow is completely hidden as an implementation detail of a class, and only the more limited state subset is exposed.streetsofboston
06/04/2020, 5:18 PMZach Klippenstein (he/him) [MOD]
06/04/2020, 5:19 PMStateFlow as a separate, read-only type in the first place?streetsofboston
06/04/2020, 5:19 PMZach Klippenstein (he/him) [MOD]
06/04/2020, 5:19 PMZach Klippenstein (he/him) [MOD]
06/04/2020, 5:20 PMtotalState.map { it.partialState }
.stateIn(scope, initialValue = totalState.value.partialState)Zach Klippenstein (he/him) [MOD]
06/04/2020, 5:27 PMbezrukov
06/04/2020, 5:55 PMstateFlow.map { it / 2 } will produce 0,1,2 which most likely unexpected there.Zach Klippenstein (he/him) [MOD]
06/04/2020, 5:56 PMStateFlow implies that the values being emitted represent “state”, and two states that are equivalent are not interesting.