asFlow

abstract fun asFlow(): Flow<T>

Calculates the value that fulfills the query conditions and returns it asynchronously as a Flow.

If there is any changes to the objects represented by the query backing the value, the flow will emit the updated value. The flow will continue running indefinitely until canceled.

The change calculations will run on the thread represented by RealmConfiguration.Builder.notificationDispatcher.

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 the RealmResults resulting from running this query.

Throws

if called on a query issued on a MutableRealm.