WeatherViewModel

ViewModel for weather data.

Handles the weather data and location data.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val isLoading: StateFlow<Boolean>
Link copied to clipboard
val selectedDay: StateFlow<Int>
Link copied to clipboard
val selectedLocation: StateFlow<Location>
Link copied to clipboard
val selectedWeather: StateFlow<WeatherData?>

Functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
fun getCity(): String?

Get the city name from the selected location.

Link copied to clipboard
Link copied to clipboard
suspend fun selectCity(city: String): WeatherData?

Select the city and fetch the weather data. If the weather data is already in the cache and it is up to date do nothing.

Link copied to clipboard

Update the weather data for the current location.

Link copied to clipboard
fun selectDay(day: Int)

Select the day to display.

Link copied to clipboard
suspend fun selectLocation(latitude: Double, longitude: Double): WeatherData?

Select the location and fetch the weather data.