MutableSubscriptionSet

interface MutableSubscriptionSet : BaseSubscriptionSet

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.

Functions

add
Link copied to clipboard
abstract fun <T> add(query: <ERROR CLASS><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.

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

Find the subscription with a given name.

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

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

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

Remove a subscription.

abstract fun remove(name: String): Boolean

Remove a named subscription.

removeAll
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> removeAll(type: KClass<T>): Boolean

Remove all subscriptions with queries on a given model class.

subscribe
Link copied to clipboard
open fun <ERROR CLASS><out <ERROR CLASS>>.subscribe(): Subscription

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

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

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

Properties

errorMessage
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.

size
Link copied to clipboard
abstract val size: Int

The number of subscriptions currently in this subscription set.

state
Link copied to clipboard
abstract val state: SubscriptionSetState

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