Hi,
Could you please describe how to use (or ideas behind of) kotlin-coroutines
extensions?
In particular, I open realm and run executeTransactionAwait
on IO dispatcher, and it throws
java.lang.IllegalStateException: Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created
The code is similar to following
withContext(Dispatchers.IO) {
openRealm().use { realm ->
realm.executeTransactionAwait {
runTransaction()
}
}
emitUpdate(value)
}
PS. We’re using MongoDB Realm 10.3.1 in the way that we don’t keep Realm opened, but instead for each transaction:
Open realm → execute transaction → close realm