Skip to content

Instantly share code, notes, and snippets.

@aqua30
Last active January 9, 2023 15:05
Show Gist options
  • Save aqua30/d592a25e8f382e69e4cda48495a0b013 to your computer and use it in GitHub Desktop.
Save aqua30/d592a25e8f382e69e4cda48495a0b013 to your computer and use it in GitHub Desktop.
class MainViewModel: ViewModel() {
private var creditScore = mutableStateOf(0)
private var age = mutableStateOf(18)
val isEligible = derivedStateOf {
creditScore > 400 && age > 18 && age < 70
}
fun creditScore(score: Int) {
creditScore.value = score
}
fun age(age: Int) {
this.age.value = age
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment