FirestoreKt

public final classFirestoreKt


Summary

Public fields

final @NonNullFirebaseFirestore

Returns theFirebaseFirestore instance of the defaultFirebaseApp.

Public methods

static final @NonNullFlow<T>
<T extends Object>FirestoreKt.dataObjects(
    @NonNullDocumentReference receiver,
    @NonNullMetadataChanges metadataChanges
)

Starts listening to the document referenced by thisDocumentReference with the given options and emits its values converted to a POJO via aFlow.

static final @NonNullFlow<@NonNullList<@NonNull T>>
<T extends Object>FirestoreKt.dataObjects(
    @NonNullQuery receiver,
    @NonNullMetadataChanges metadataChanges
)

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

static final @NonNullFirebaseFirestore
FirestoreKt.firestore(
    @NonNullFirebase receiver,
    @NonNullFirebaseApp app
)

Returns theFirebaseFirestore instance of a givenFirebaseApp.

static final @NonNullFirebaseFirestore
FirestoreKt.firestore(
    @NonNullFirebase receiver,
    @NonNullString database
)

Returns theFirebaseFirestore instance of the defaultFirebaseApp, given the database name.

static final @NonNullFirebaseFirestore
FirestoreKt.firestore(
    @NonNullFirebase receiver,
    @NonNullFirebaseApp app,
    @NonNullString database
)

Returns theFirebaseFirestore instance of a givenFirebaseApp and database name.

static final @NonNullFirebaseFirestoreSettings

Returns aFirebaseFirestoreSettings instance initialized using theinit function.

static final T
<T extends Object>FirestoreKt.getField(
    @NonNullDocumentSnapshot receiver,
    @NonNullString 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(
    @NonNullDocumentSnapshot receiver,
    @NonNullFieldPath 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(
    @NonNullDocumentSnapshot receiver,
    @NonNullString field,
    @NonNullDocumentSnapshot.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(
    @NonNullDocumentSnapshot receiver,
    @NonNullFieldPath fieldPath,
    @NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

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

static final @NonNullMemoryCacheSettings
static final @NonNullMemoryEagerGcSettings
static final @NonNullMemoryLruGcSettings
static final @NonNullPersistentCacheSettings
static final @NonNullFlow<@NonNullDocumentSnapshot>
FirestoreKt.snapshots(
    @NonNullDocumentReference receiver,
    @NonNullMetadataChanges metadataChanges
)

Starts listening to the document referenced by thisDocumentReference with the given options and emits its values via aFlow.

static final @NonNullFlow<@NonNullQuerySnapshot>
FirestoreKt.snapshots(
    @NonNullQuery receiver,
    @NonNullMetadataChanges metadataChanges
)

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

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(
    @NonNullDocumentSnapshot receiver,
    @NonNullDocumentSnapshot.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(
    @NonNullQueryDocumentSnapshot receiver,
    @NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the document converted to a POJO.

static final @NonNullList<@NonNull T>

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

static final @NonNullList<@NonNull T>
<T extends Object>FirestoreKt.toObjects(
    @NonNullQuerySnapshot receiver,
    @NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

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

Public fields

firestore

public final @NonNullFirebaseFirestore firestore

Returns theFirebaseFirestore instance of the defaultFirebaseApp.

Public methods

FirestoreKt.dataObjects

public static final @NonNullFlow<T> <T extends Object>FirestoreKt.dataObjects(
    @NonNullDocumentReference receiver,
    @NonNullMetadataChanges metadataChanges
)

Starts listening to the document referenced by thisDocumentReference with the given options and emits its values converted to a POJO via aFlow.

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

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

Parameters
<T extends Object>

The type of the object to convert to.

@NonNullMetadataChanges metadataChanges

controls metadata-only changes. Default:MetadataChanges.EXCLUDE

FirestoreKt.dataObjects

public static final @NonNullFlow<@NonNullList<@NonNull T>> <T extends Object>FirestoreKt.dataObjects(
    @NonNullQuery receiver,
    @NonNullMetadataChanges metadataChanges
)

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

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

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

Parameters
<T extends Object>

The type of the object to convert to.

@NonNullMetadataChanges metadataChanges

controls metadata-only changes. Default:MetadataChanges.EXCLUDE

FirestoreKt.firestore

public static final @NonNullFirebaseFirestore FirestoreKt.firestore(
    @NonNullFirebase receiver,
    @NonNullFirebaseApp app
)

Returns theFirebaseFirestore instance of a givenFirebaseApp.

FirestoreKt.firestore

public static final @NonNullFirebaseFirestore FirestoreKt.firestore(
    @NonNullFirebase receiver,
    @NonNullString database
)

Returns theFirebaseFirestore instance of the defaultFirebaseApp, given the database name.

FirestoreKt.firestore

public static final @NonNullFirebaseFirestore FirestoreKt.firestore(
    @NonNullFirebase receiver,
    @NonNullFirebaseApp app,
    @NonNullString database
)

Returns theFirebaseFirestore instance of a givenFirebaseApp and database name.

firestoreSettings

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

Returns aFirebaseFirestoreSettings instance initialized using theinit function.

FirestoreKt.getField

public static final T <T extends Object>FirestoreKt.getField(
    @NonNullDocumentSnapshot receiver,
    @NonNullString 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.

@NonNullString 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(
    @NonNullDocumentSnapshot receiver,
    @NonNullFieldPath 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.

@NonNullFieldPath 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(
    @NonNullDocumentSnapshot receiver,
    @NonNullString field,
    @NonNullDocumentSnapshot.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.

@NonNullString field

The path to the field.

@NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

beensettotheirfinalvalue.
@return

The value at the given field or null.

FirestoreKt.getField

public static final T <T extends Object>FirestoreKt.getField(
    @NonNullDocumentSnapshot receiver,
    @NonNullFieldPath fieldPath,
    @NonNullDocumentSnapshot.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.

@NonNullFieldPath fieldPath

The path to the field.

@NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

beensettotheirfinalvalue.
@return

The value at the given field or null.

memoryCacheSettings

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

memoryEagerGcSettings

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

memoryLruGcSettings

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

persistentCacheSettings

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

FirestoreKt.snapshots

public static final @NonNullFlow<@NonNullDocumentSnapshotFirestoreKt.snapshots(
    @NonNullDocumentReference receiver,
    @NonNullMetadataChanges metadataChanges
)

Starts listening to the document referenced by thisDocumentReference with the given options and emits its values via aFlow.

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

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

Parameters
@NonNullMetadataChanges metadataChanges

controls metadata-only changes. Default:MetadataChanges.EXCLUDE

FirestoreKt.snapshots

public static final @NonNullFlow<@NonNullQuerySnapshotFirestoreKt.snapshots(
    @NonNullQuery receiver,
    @NonNullMetadataChanges metadataChanges
)

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

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

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

Parameters
@NonNullMetadataChanges metadataChanges

controls metadata-only changes. Default:MetadataChanges.EXCLUDE

FirestoreKt.toObject

public static final T <T extends Object>FirestoreKt.toObject(@NonNullDocumentSnapshot 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(@NonNullQueryDocumentSnapshot 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(
    @NonNullDocumentSnapshot receiver,
    @NonNullDocumentSnapshot.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.

@NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

beensettotheirfinalvalue.
@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(
    @NonNullQueryDocumentSnapshot receiver,
    @NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior
)

Returns the contents of the document converted to a POJO.

Parameters
<T extends Object>

The type of the object to create.

@NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

beensettotheirfinalvalue.
@return

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

FirestoreKt.toObjects

public static final @NonNullList<@NonNull T> <T extends Object>FirestoreKt.toObjects(@NonNullQuerySnapshot 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 @NonNullList<@NonNull T> <T extends Object>FirestoreKt.toObjects(
    @NonNullQuerySnapshot receiver,
    @NonNullDocumentSnapshot.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.

@NonNullDocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior

Configures the behavior for server timestamps that have not yet

    been set to their final value.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.