MutableSubscriptionSet

A mutable subscription set makes it possible to add, remove or modify a SubscriptionSet. It becomes available when calling SubscriptionSet.update.

See also

for more information about subscription sets and Flexible Sync.

Properties

Link copied to clipboard
abstract val errorMessage: String?

If state returns SubscriptionSetState.ERROR, this method will return the reason. Errors can be fixed by modifying the subscription accordingly and then call SubscriptionSet.waitForSynchronization.

Link copied to clipboard
abstract val size: Int

The number of subscriptions currently in this subscription set.

Link copied to clipboard

The current state of the SubscriptionSet. See SubscriptionSetState for more details about each state.

Functions

Link copied to clipboard
abstract fun <T : RealmObject> add(query: RealmQuery<T>, name: String? = null, updateExisting: Boolean = false): Subscription

Adds a new subscription to the subscription set. If an existing subscription exists that matches the query and the name, this operation does nothing and the existing subscription will be returned.

Link copied to clipboard
abstract fun findByName(name: String): Subscription?

Find the subscription with a given name.

Link copied to clipboard
abstract fun <T : RealmObject> findByQuery(query: RealmQuery<T>): Subscription?

Find the first subscription that contains the given query. It is possible for multiple named subscriptions to contain the same query.

Link copied to clipboard
abstract operator fun iterator(): Iterator<Subscription>
Link copied to clipboard
abstract fun remove(subscription: Subscription): Boolean

Remove a subscription.

abstract fun remove(name: String): Boolean

Remove a named subscription.

Link copied to clipboard
abstract fun removeAll(anonymousOnly: Boolean = false): Boolean

Remove all subscriptions in this subscription set.

abstract fun removeAll(objectType: String): Boolean

Remove all subscriptions with queries on a given Subscription.objectType.

abstract fun <T : RealmObject> removeAll(type: KClass<T>): Boolean

Remove all subscriptions with queries on a given model class.

Link copied to clipboard

Creates an anonymous Subscription in the current MutableSubscriptionSet directly from a RealmQuery.

open fun RealmQuery<out RealmObject>.subscribe(name: String, updateExisting: Boolean = false): Subscription

Creates a named Subscription in the current MutableSubscriptionSet directly from a RealmQuery.