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

isManaged

fun RealmModel.isManaged(): 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.

If this method returns false, the object is unmanaged. An unmanaged object is just a normal Kotlin object, so it can be passed freely across threads, but the data in the object is not connected to the underlying Realm, so it will not be live updated.

It is possible to create a managed object from an unmanaged object by using io.realm.Realm.copyToRealm. An unmanaged object can be created from a managed object by using io.realm.Realm.copyFromRealm.

Return
true if the object is managed, false if it is unmanaged.