com.google.firebase.firestore.ktx

Top-level functions summary

Extension functions summary

inline Flow<T?>

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

inline Flow<List<T>>
<T : Any> Query.dataObjects(metadataChanges: MetadataChanges)

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

FirebaseFirestore
Firebase.firestore(app: FirebaseApp, database: String)

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

FirebaseFirestore

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

FirebaseFirestore

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

inline T?
<T : Any?> DocumentSnapshot.getField(
    fieldPath: FieldPath,
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
)

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

inline T?
<T : Any?> DocumentSnapshot.getField(fieldPath: FieldPath)

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

inline T?
<T : Any?> DocumentSnapshot.getField(
    field: String,
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
)

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

inline T?

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

Flow<DocumentSnapshot>

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

Flow<QuerySnapshot>
Query.snapshots(metadataChanges: MetadataChanges)

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

inline T?

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

inline T?
<T : Any?> DocumentSnapshot.toObject(
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
)

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

inline T

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

inline T

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

inline List<T>

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

inline List<T>
<T : Any> QuerySnapshot.toObjects(
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
)

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

Extension properties summary

FirebaseFirestore

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

Top-level functions

firestoreSettings

fun firestoreSettings(init: FirebaseFirestoreSettings.Builder.() -> Unit): FirebaseFirestoreSettings

Returns a FirebaseFirestoreSettings instance initialized using the init function.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

memoryCacheSettings

fun memoryCacheSettings(init: MemoryCacheSettings.Builder.() -> Unit): MemoryCacheSettings

memoryLruGcSettings

fun memoryLruGcSettings(init: MemoryLruGcSettings.Builder.() -> Unit): MemoryLruGcSettings

Extension functions

dataObjects

inline fun <T : Any> DocumentReference.dataObjects(
    metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE
): Flow<T?>

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.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any>

The type of the object to convert to.

metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

dataObjects

inline fun <T : Any> Query.dataObjects(
    metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE
): Flow<List<T>>

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.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any>

The type of the object to convert to.

metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

firestore

fun Firebase.firestore(app: FirebaseApp, database: String): FirebaseFirestore

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

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

firestore

fun Firebase.firestore(app: FirebaseApp): FirebaseFirestore

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

Returns the FirebaseFirestore instance of a given FirebaseApp.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

firestore

fun Firebase.firestore(database: String): FirebaseFirestore

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

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

getField

inline fun <T : Any?> DocumentSnapshot.getField(
    fieldPath: FieldPath,
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
): T?

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any?>

The type to convert the field value to.

fieldPath: FieldPath

The path to the field.

serverTimestampBehavior: DocumentSnapshot.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.

getField

inline fun <T : Any?> DocumentSnapshot.getField(fieldPath: FieldPath): T?

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any?>

The type to convert the field value to.

fieldPath: FieldPath

The path to the field.

Returns
T?

The value at the given field or null.

getField

inline fun <T : Any?> DocumentSnapshot.getField(
    field: String,
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
): T?

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any?>

The type to convert the field value to.

field: String

The path to the field.

serverTimestampBehavior: DocumentSnapshot.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.

getField

inline fun <T : Any?> DocumentSnapshot.getField(field: String): T?

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any?>

The type to convert the field value to.

field: String

The path to the field.

Returns
T?

The value at the given field or null.

snapshots

fun DocumentReference.snapshots(
    metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE
): Flow<DocumentSnapshot>

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.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

snapshots

fun Query.snapshots(
    metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE
): Flow<QuerySnapshot>

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.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
metadataChanges: MetadataChanges = MetadataChanges.EXCLUDE

controls metadata-only changes. Default: MetadataChanges.EXCLUDE

toObject

inline fun <T : Any?> DocumentSnapshot.toObject(): T?

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any?>

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.

toObject

inline fun <T : Any?> DocumentSnapshot.toObject(
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
): T?

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any?>

The type of the object to create.

serverTimestampBehavior: DocumentSnapshot.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.

toObject

inline fun <T : Any> QueryDocumentSnapshot.toObject(): T

Returns the contents of the document converted to a POJO.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any>

The type of the object to create.

Returns
T

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

toObject

inline fun <T : Any> QueryDocumentSnapshot.toObject(
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
): T

Returns the contents of the document converted to a POJO.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any>

The type of the object to create.

serverTimestampBehavior: DocumentSnapshot.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.

toObjects

inline fun <T : Any> QuerySnapshot.toObjects(): List<T>

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any>

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

toObjects

inline fun <T : Any> QuerySnapshot.toObjects(
    serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior
): List<T>

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

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

Parameters
<T : Any>

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

serverTimestampBehavior: DocumentSnapshot.ServerTimestampBehavior

Configures the behavior for server timestamps that have not yet

    been set to their final value.

Extension properties

firestore

val Firebase.firestoreFirebaseFirestore

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

Returns the FirebaseFirestore instance of the default FirebaseApp.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-database-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.