Skip to content

Instantly share code, notes, and snippets.

@Skyyo
Created April 18, 2021 20:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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