Pablo
12/03/2024, 10:48 PMfun getAllBusStops(): Flow<List<BusStopEntity>>
and this extension function to transform the BusStopEntity in a BusStop class:
fun BusStopEntity.asBusStop() = BusStop(id = id,name = name,lat = lat,lon = lon)
How can I convert the Flow<List<BusStopEntity>> in a Flow<List<BusStop>> using that extension function?George Z
12/03/2024, 10:52 PMmap
operator, something like:
fun getAllBusStops(): Flow<List<BusStop>> {
return getAllBusStops()
.map { entityList ->
entityList.map { it.asBusStop() }
}
}
Pablo
12/03/2024, 10:54 PMPablo
12/03/2024, 10:55 PM