abstract suspend fun <R> write(block: MutableRealm.() -> R): R

Modify the underlying Realm file in a suspendable transaction on the default Realm Write Dispatcher.

The write transaction always represent the latest version of data in the Realm file, even if the calling realm not yet represent this.

Write transactions automatically commit any changes made when the closure returns unless MutableRealm.cancelWrite was called.


any value returned from the provided write block. If this is a RealmObject it is frozen before being returned.



function that should be run within the context of a write transaction.