Flow observe changes of another flow in Kotlin
I am making an weather app and want the weather update whenever receive new location. But I always meet crash here. I already log the location retrieve to confirm its lat and lon.
private val _currentLocation = MutableStateFlow(MapLocation())
init {
viewModelScope.launch {
locationRepository.location.collect {
_currentLocation.value = it
Log.d(TAG, _currentLocation.value.toString())
}
}
}
val...