asFlow

abstract fun asFlow(): Flow<RealmChange<Realm>>

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.

The change calculations will run on the thread defined through the Configuration Notification Dispatcher.

The flow has an internal buffer of Channel.BUFFERED but if the consumer fails to consume the elements in a timely manner the coroutine scope will be cancelled with a CancellationException.

Return

a flow representing changes to this realm.