I suppose maybe this doesn’t illustrate the full i...
# announcements
r
I suppose maybe this doesn’t illustrate the full issue, here’s the actual code I’m trying to get working:
Copy code
fun <T : RealmModel> T.clear() {
    Realm.getDefaultInstance().use { ext ->
        ext.executeTransaction { realm ->
            realm.delete(this::class.java)
        }
    }
}

//...

fun addThing(thing: Thing?) {
    thing?.add() ?: thing.clear()
}