asFlow

abstract fun asFlow(): Flow<ResultsChange<T>>

Finds all objects that fulfill the query conditions and returns them asynchronously as a Flow.

Once subscribed the flow will emit a InitialResults event and then a UpdatedResults on any change to the objects represented by the query backing the RealmResults. The flow will continue running indefinitely until canceled.

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

It is not allowed to call asFlow on queries generated from a MutableRealm.

Return

a flow representing changes to the RealmResults resulting from running this query.