Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class LifecycleAwareCurrenciesViewModel : ViewModel() {
private val _currencyPrices = MutableStateFlow(listOf<CurrencyPrice>())
val currencyPrices: StateFlow<List<CurrencyPrice>> get() = _currencyPrices
init {
getCurrencyPrices()
}
private fun getCurrencyPrices() {} //same as before
fun onCurrencyUpdated(newPrice: Int, index: Int) { } //same as before
fun provideCurrencyUpdateFlow(): Flow<Int> { } //same as before
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment