Joakim Forslund
03/10/2022, 6:03 PMsuspend fun delete(){
val users = realm.query<UserDao>().find()
realm.write {
delete(users)
}
}
Throws: java.lang.IllegalStateException: Could not execute the write transaction: RealmCoreException([5]: Must be in a write transaction) for kotlin multiplatform 1.6.10, this happens currently on Android
Am I doing something wrong?Claus Rørbech
03/10/2022, 6:30 PMfindLatest
as shown in https://github.com/realm/realm-kotlin#update
But in your case, where you are immediately looking up the objects, you can also just do the actual query inside the write-block as shown in https://github.com/realm/realm-kotlin#deleteJoakim Forslund
03/11/2022, 5:14 AMJoakim Forslund
03/11/2022, 5:51 AMquery<UserDao>()
directly in delete seems to work