Skip to content

Instantly share code, notes, and snippets.

@cmelchior
Created July 16, 2021 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmelchior/a465df7541ea2470d04c4a9902b9d818 to your computer and use it in GitHub Desktop.
Save cmelchior/a465df7541ea2470d04c4a9902b9d818 to your computer and use it in GitHub Desktop.
Realm Kotlin 0.40 Release Blog Post - Observing Changes
val jane = getJane()
CoroutineScope(Dispatchers.Main).launch {
// Updates are observed using Kotlin Flow
val flow: Flow<Person> = jane.observe()
flow.collect {
// Listen to changes to the object
println(it.name)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment