delete
Delete objects from the underlying Realm.
RealmObject, EmbeddedRealmObject, RealmList, RealmQuery, RealmSingleQuery and RealmResults can be deleted this way.
NOTE: Only live objects can be deleted. Frozen objects must be resolved in the current context by using MutableRealm.findLatest:
val frozenObj = realm.query<Sample>.first().find()
realm.write {
findLatest(frozenObject)?.let { delete(it) }
}
Parameters
deleteable
the RealmObject, EmbeddedRealmObject, RealmList, RealmQuery, RealmSingleQuery or RealmResults to delete.
Throws
if the object is invalid, frozen or not managed by Realm.