ListenSource

public enum ListenSource


Configures the source option of addSnapshotListener() calls on DocumentReference and Query. This controls how a listener retrieves data updates.

Summary

Enum Values

CACHE

The listener retrieves data and listens to updates from the local Firestore cache only.

DEFAULT

The default behavior.

Public methods

static ListenSource

Returns the enum constant of this type with the specified name.

static ListenSource[]

Returns an array containing the constants of this enum type, in the order they're declared.

Enum Values

CACHE

ListenSource ListenSource.CACHE

The listener retrieves data and listens to updates from the local Firestore cache only. If the cache is empty, an empty snapshot will be returned. Snapshot events will be triggered on cache updates, like local mutations or load bundles.

Note that the data might be stale if the cache hasn't synchronized with recent server-side changes.

DEFAULT

ListenSource ListenSource.DEFAULT

The default behavior. The listener attempts to return initial snapshot from cache and retrieve up-to-date snapshots from the Firestore server. Snapshot events will be triggered on local mutations and server side updates.

Public methods

valueOf

public static ListenSource valueOf(String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Returns
ListenSource

the enum constant with the specified name

Throws
java.lang.IllegalArgumentException java.lang.IllegalArgumentException

if this enum type has no constant with the specified name

values

public static ListenSource[] values()

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.

Returns
ListenSource[]

an array containing the constants of this enum type, in the order they're declared