Brett May
07/30/2021, 7:57 AM@Published var meInformation : Me? {
didSet {
print("MeInformation changed: \(meInformation)")
}
}
This doesn’t compile for me: (unresolved reference: by)
class AuthenticatedUser(val context: Context) : ViewModel() {
var meInformation: MutableState<MeInformation?> = mutableStateOf(null) by Delegates.observable("<no name>") {
prop, old, new ->
println("$old -> $new")
}
}
I’m not sure if it matters (being new to Kotlin), but meInformation is a @Serializable objectdivid3d
07/30/2021, 8:24 AMMutableStateFlow
and StateFlow
are what might you looking for.
https://developer.android.com/kotlin/flow/stateflow-and-sharedflowAdam Powell
07/30/2021, 1:25 PMBrett May
07/31/2021, 1:59 AMBrett May
07/31/2021, 2:06 AM