kotlin-extensions / io.realm.kotlin / io.realm.RealmModel

Extensions for io.realm.RealmModel


Deletes the object from the Realm it is currently associated with.

fun RealmModel.deleteFromRealm(): Unit


Returns a frozen snapshot of this object. The frozen copy can be read and queried from any thread without throwing an IllegalStateException.

fun <T : RealmModel> RealmModel.freeze(): T


Returns whether or not this RealmModel is frozen.

fun RealmModel.isFrozen(): Boolean


Checks if the query used to find this RealmObject has completed.

fun RealmModel.isLoaded(): Boolean


Checks if this object is managed by Realm. A managed object is just a wrapper around the data in the underlying Realm file. On Looper threads, a managed object will be live-updated so it always points to the latest data. It is possible to register a change listener using addChangeListener to be notified when changes happen. Managed objects are thread confined so that they cannot be accessed from other threads than the one that created them.

fun RealmModel.isManaged(): Boolean


Checks if the RealmObject is still valid to use i.e., the RealmObject hasn't been deleted nor has the Realm been closed. It will always return true for unmanaged objects.

fun RealmModel.isValid(): Boolean


Makes an asynchronous query blocking. This will also trigger any registered listeners.

fun RealmModel.load(): Boolean


Removes all registered listeners from the given RealmObject.

fun RealmModel.removeAllChangeListeners(): Unit