RealmSingleQuery

Query returning a single RealmObject or EmbeddedRealmObject.

Functions

Link copied to clipboard
abstract fun asFlow(keyPaths: List<String>? = null): Flow<SingleQueryChange<T>>

Observes changes to the first object that fulfills the query conditions. The flow will emit SingleQueryChange events on any changes to the first object represented by the query. The flow will continue running indefinitely until cancelled.

Link copied to clipboard
abstract fun find(): T?

Finds the first object that fulfills the query conditions and returns it in a blocking fashion.

Link copied to clipboard
fun <T : BaseRealmObject, R> RealmSingleQuery<T>.find(block: (T?) -> R): R

Similar to RealmSingleQuery.find but it receives a block in which the RealmObject or EmbeddedRealmObject from the query is provided.