Realm
A Realm instance is the main entry point for interacting with a persisted realm.
See also
Functions
Observe changes to the realm. The flow will emit a RealmChange once subscribed and then, on every change to the realm. The flow will continue running indefinitely until canceled or the realm instance is closed.
Close this realm and all underlying resources. Accessing any methods or Realm Objects after this method has been called will then an IllegalStateException.
Makes an unmanaged in-memory copy of an already persisted io.realm.kotlin.types.RealmObject. This is a deep copy that will copy all referenced objects.
Makes an unmanaged in-memory copy of a RealmDictionary of already persisted io.realm.kotlin.types.RealmObjects. This is a deep copy that will copy all referenced objects.
Makes an unmanaged in-memory copy of a collection of already persisted io.realm.kotlin.types.RealmObjects. This is a deep copy that will copy all referenced objects.
Returns the current number of active versions in the Realm file. A large number of active versions can have a negative impact on the Realm file size on disk.
Check if this Realm has been closed or not. If the Realm has been closed, most methods will throw IllegalStateException if called.
Returns a RealmQuery matching the predicate represented by query.
Returns a RealmQuery matching the predicate represented by query.
Returns an immutable schema of the realm.
Returns the schema version of the realm.
Modify the underlying Realm file while blocking the calling thread until the transaction is done. Write transactions automatically commit any changes made when the closure returns unless MutableRealm.cancelWrite was called.
Writes a compacted copy of the Realm to the given destination as defined by the targetConfiguration. The resulting file can be used for a number of purposes: