FirestoreKt

public final class FirestoreKt


Summary

Public fields

final @NonNull FirebaseFirestore

Returns the FirebaseFirestore instance of the default FirebaseApp.

Public methods

static final @NonNull Flow<T>
<T extends Object> FirestoreKt.dataObjects(
    @NonNull DocumentReference receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to the document referenced by this DocumentReference with the given options and emits its values converted to a POJO via a Flow.

static final @NonNull Flow<@NonNull List<@NonNull T>>
<T extends Object> FirestoreKt.dataObjects(
    @NonNull Query receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to this query with the given options and emits its values converted to a POJO via a Flow.

static final @NonNull FirebaseFirestore
FirestoreKt.firestore(
    @NonNull Firebase receiver,
    @NonNull FirebaseApp app
)

Returns the FirebaseFirestore instance of a given FirebaseApp.

static final @NonNull FirebaseFirestore
FirestoreKt.firestore(
    @NonNull Firebase receiver,
    @NonNull String database
)

Returns the FirebaseFirestore instance of the default FirebaseApp, given the database name.

static final @NonNull FirebaseFirestore
FirestoreKt.firestore(
    @NonNull Firebase receiver,
    @NonNull FirebaseApp app,
    @NonNull String database
)

Returns the FirebaseFirestore instance of a given FirebaseApp and database name.

static final @NonNull FirebaseFirestoreSettings

Returns a FirebaseFirestoreSettings instance initialized using the init function.

static final T
<T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull String field
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

static final T
<T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull FieldPath fieldPath
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

static final T
<T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull String field,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

static final T
<T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull FieldPath fieldPath,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

static final @NonNull MemoryCacheSettings
static final @NonNull MemoryEagerGcSettings
static final @NonNull MemoryLruGcSettings
static final @NonNull PersistentCacheSettings
static final @NonNull Flow<@NonNull DocumentSnapshot>
FirestoreKt.snapshots(
    @NonNull DocumentReference receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to the document referenced by this DocumentReference with the given options and emits its values via a Flow.

static final @NonNull Flow<@NonNull QuerySnapshot>
FirestoreKt.snapshots(
    @NonNull Query receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to this query with the given options and emits its values via a Flow.

static final T

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

static final @NonNull T

Returns the contents of the document converted to a POJO.

static final T
<T extends Object> FirestoreKt.toObject(
    @NonNull DocumentSnapshot receiver,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

static final @NonNull T
<T extends Object> FirestoreKt.toObject(
    @NonNull QueryDocumentSnapshot receiver,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the document converted to a POJO.

static final @NonNull List<@NonNull T>

Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.

static final @NonNull List<@NonNull T>
<T extends Object> FirestoreKt.toObjects(
    @NonNull QuerySnapshot receiver,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.

Public fields

firestore

public final @NonNull FirebaseFirestore firestore

Returns the FirebaseFirestore instance of the default FirebaseApp.

Public methods

FirestoreKt.dataObjects

public static final @NonNull Flow<T> <T extends Object> FirestoreKt.dataObjects(
    @NonNull DocumentReference receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to the document referenced by this DocumentReference with the given options and emits its values converted to a POJO via a Flow.

  • When the returned flow starts being collected, an EventListener will be attached.

  • When the flow completes, the listener will be removed.

Parameters
<T extends Object>

The type of the object to convert to.

@NonNull MetadataChanges metadataChanges

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

FirestoreKt.dataObjects

public static final @NonNull Flow<@NonNull List<@NonNull T>> <T extends Object> FirestoreKt.dataObjects(
    @NonNull Query receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to this query with the given options and emits its values converted to a POJO via a Flow.

  • When the returned flow starts being collected, an EventListener will be attached.

  • When the flow completes, the listener will be removed.

Parameters
<T extends Object>

The type of the object to convert to.

@NonNull MetadataChanges metadataChanges

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

FirestoreKt.firestore

public static final @NonNull FirebaseFirestore FirestoreKt.firestore(
    @NonNull Firebase receiver,
    @NonNull FirebaseApp app
)

Returns the FirebaseFirestore instance of a given FirebaseApp.

FirestoreKt.firestore

public static final @NonNull FirebaseFirestore FirestoreKt.firestore(
    @NonNull Firebase receiver,
    @NonNull String database
)

Returns the FirebaseFirestore instance of the default FirebaseApp, given the database name.

FirestoreKt.firestore

public static final @NonNull FirebaseFirestore FirestoreKt.firestore(
    @NonNull Firebase receiver,
    @NonNull FirebaseApp app,
    @NonNull String database
)

Returns the FirebaseFirestore instance of a given FirebaseApp and database name.

firestoreSettings

public static final @NonNull FirebaseFirestoreSettings firestoreSettings(
    @ExtensionFunctionType @NonNull Function1<@NonNull FirebaseFirestoreSettings.BuilderUnit> init
)

Returns a FirebaseFirestoreSettings instance initialized using the init function.

FirestoreKt.getField

public static final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull String field
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

Parameters
<T extends Object>

The type to convert the field value to.

@NonNull String field

The path to the field.

Returns
T

The value at the given field or null.

FirestoreKt.getField

public static final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull FieldPath fieldPath
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

Parameters
<T extends Object>

The type to convert the field value to.

@NonNull FieldPath fieldPath

The path to the field.

Returns
T

The value at the given field or null.

FirestoreKt.getField

public static final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull String field,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

Parameters
<T extends Object>

The type to convert the field value to.

@NonNull String field

The path to the field.

@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

        been set to their final value.
@return

The value at the given field or null.

FirestoreKt.getField

public static final T <T extends Object> FirestoreKt.getField(
    @NonNull DocumentSnapshot receiver,
    @NonNull FieldPath fieldPath,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

Parameters
<T extends Object>

The type to convert the field value to.

@NonNull FieldPath fieldPath

The path to the field.

@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

        been set to their final value.
@return

The value at the given field or null.

memoryCacheSettings

public static final @NonNull MemoryCacheSettings memoryCacheSettings(
    @ExtensionFunctionType @NonNull Function1<@NonNull MemoryCacheSettings.BuilderUnit> init
)

memoryEagerGcSettings

public static final @NonNull MemoryEagerGcSettings memoryEagerGcSettings(
    @ExtensionFunctionType @NonNull Function1<@NonNull MemoryEagerGcSettings.BuilderUnit> init
)

memoryLruGcSettings

public static final @NonNull MemoryLruGcSettings memoryLruGcSettings(
    @ExtensionFunctionType @NonNull Function1<@NonNull MemoryLruGcSettings.BuilderUnit> init
)

persistentCacheSettings

public static final @NonNull PersistentCacheSettings persistentCacheSettings(
    @ExtensionFunctionType @NonNull Function1<@NonNull PersistentCacheSettings.BuilderUnit> init
)

FirestoreKt.snapshots

public static final @NonNull Flow<@NonNull DocumentSnapshotFirestoreKt.snapshots(
    @NonNull DocumentReference receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to the document referenced by this DocumentReference with the given options and emits its values via a Flow.

  • When the returned flow starts being collected, an EventListener will be attached.

  • When the flow completes, the listener will be removed.

Parameters
@NonNull MetadataChanges metadataChanges

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

FirestoreKt.snapshots

public static final @NonNull Flow<@NonNull QuerySnapshotFirestoreKt.snapshots(
    @NonNull Query receiver,
    @NonNull MetadataChanges metadataChanges
)

Starts listening to this query with the given options and emits its values via a Flow.

  • When the returned flow starts being collected, an EventListener will be attached.

  • When the flow completes, the listener will be removed.

Parameters
@NonNull MetadataChanges metadataChanges

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

FirestoreKt.toObject

public static final T <T extends Object> FirestoreKt.toObject(@NonNull DocumentSnapshot receiver)

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

Parameters
<T extends Object>

The type of the object to create.

Returns
T

The contents of the document in an object of type T or null if the document doesn't

    exist.

FirestoreKt.toObject

public static final @NonNull T <T extends Object> FirestoreKt.toObject(@NonNull QueryDocumentSnapshot receiver)

Returns the contents of the document converted to a POJO.

Parameters
<T extends Object>

The type of the object to create.

Returns
@NonNull T

The contents of the document in an object of type T.

FirestoreKt.toObject

public static final T <T extends Object> FirestoreKt.toObject(
    @NonNull DocumentSnapshot receiver,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

Parameters
<T extends Object>

The type of the object to create.

@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

        been set to their final value.
@return

The contents of the document in an object of type T or null if the document doesn't

    exist.

FirestoreKt.toObject

public static final @NonNull T <T extends Object> FirestoreKt.toObject(
    @NonNull QueryDocumentSnapshot receiver,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the document converted to a POJO.

Parameters
<T extends Object>

The type of the object to create.

@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

        been set to their final value.
@return

The contents of the document in an object of type T.

FirestoreKt.toObjects

public static final @NonNull List<@NonNull T> <T extends Object> FirestoreKt.toObjects(@NonNull QuerySnapshot receiver)

Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.

Parameters
<T extends Object>

The POJO type used to convert the documents in the list.

FirestoreKt.toObjects

public static final @NonNull List<@NonNull T> <T extends Object> FirestoreKt.toObjects(
    @NonNull QuerySnapshot receiver,
    @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.

Parameters
<T extends Object>

The POJO type used to convert the documents in the list.

@NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

    been set to their final value.