FirestoreKt

public final class FirestoreKt


Summary

Public fields

final @NonNull FirebaseFirestore

Accessing this object for Kotlin apps has changed; see the migration guide.

Public methods

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

Accessing this object for Kotlin apps has changed; see the migration guide.

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

Accessing this object for Kotlin apps has changed; see the migration guide.

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

Accessing this object for Kotlin apps has changed; see the migration guide.

static final @NonNull FirebaseFirestoreSettings

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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
)

This method is deprecated. com.google.firebase.fires

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

static final T

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

static final @NonNull T

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

static final @NonNull List<@NonNull T>

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

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

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

Public fields

firestore

public final @NonNull FirebaseFirestore firestore

Accessing this object for Kotlin apps has changed; see the migration guide.

Returns the FirebaseFirestore instance of the default FirebaseApp.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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
)

Accessing this object for Kotlin apps has changed; see the migration guide.

Returns the FirebaseFirestore instance of a given FirebaseApp.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

FirestoreKt.firestore

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

Accessing this object for Kotlin apps has changed; see the migration guide.

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

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

FirestoreKt.firestore

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

Accessing this object for Kotlin apps has changed; see the migration guide.

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

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

firestoreSettings

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

Returns a FirebaseFirestoreSettings instance initialized using the init function.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.

Important: In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.

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.