MutableRealm

interface MutableRealm : TypedRealm

Represents the writeable state of a Realm file.

To modify data in a Realm, use instances of this class. These are provided and managed automatically through either Realm.write or Realm.writeBlocking.

All objects created and/or obtained from the mutable realm in a write-transaction are bound to the thread executing the transaction. All operations on the mutable realm or on any of the objects contained in that realm must execute on the thread executing the transaction. The only exception is objects returned from Realm.write and Realm.writeBlocking, which are frozen and remain tied to the resulting version of the write-transaction.

Functions

cancelWrite
Link copied to clipboard
common
abstract fun cancelWrite()
Cancel the write.
copyToRealm
Link copied to clipboard
common
abstract fun <T : RealmObject> copyToRealm(instance: T): T
Creates a copy of an object in the Realm.
delete
Link copied to clipboard
common
abstract fun <T : RealmObject> delete(obj: T)
Deletes the object from the underlying Realm.
findLatest
Link copied to clipboard
common
abstract fun <T : RealmObject> findLatest(obj: T): T?
Get latest version of an object.
getNumberOfActiveVersions
Link copied to clipboard
common
abstract fun getNumberOfActiveVersions(): Long
Returns the current number of active versions in the Realm file.
isClosed
Link copied to clipboard
common
abstract fun isClosed(): Boolean
Check if this Realm has been closed or not.
objects
Link copied to clipboard
common
abstract override fun <T : RealmObject> objects(clazz: KClass<T>): RealmResults<T>
Returns the results of querying for all objects of a specific type.
version
Link copied to clipboard
common
abstract fun version(): VersionId
Returns the Realm version of this object.

Properties

configuration
Link copied to clipboard
common
abstract val configuration: RealmConfiguration
Configuration used to configure this Realm instance.