Maxime Vince
Rick Clephas
KMMViewModel
CoroutineScope
viewModelScope.coroutineScope
SanjayKarki
private fun getVlilleStations() { _vLilleStations.update { UiState.loading() } viewModelScope.coroutineScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) { val stations = _vLilleRepository.getVLilleStations() val location = _locationHandler.getCurrentLocation() val orderedList = stations .map { it.fields } .sortedBy { calculationByDistance( location.latitude, location.longitude, it.localisation[0], it.localisation[1] ) } _vLilleStations.update { UiState.success(MapScreenData(orderedList, location)) } } }
A modern programming language that makes developers happier.