How to read preference with glance Widget Jetpack compose?
I'm trying to do a weather app with a widget.
I call open weather map api and I can see the wether in the main screen on the phone.
I save them in dataStore with :
mainViewModel.setCity(city)
fun setCity(city: String){
viewModelScope.launch {
preferenceManager.setWeatherCity(city)
}
}
suspend fun setWeatherCity(city: String){
application.applicationContext.pref.edit { preference ->
preference[stringPreferencesKey("weather_city")] = city
}
}
I read them in...