ktx / com.google.firebase.firestore.ktx / com.google.firebase.firestore.DocumentSnapshot / getField

getField

inline fun <reified T> 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.

Parameters

field - The path to the field.

T - The type to convert the field value to.

Return
The value at the given field or null.

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

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

Parameters

field - The path to the field.

T - The type to convert the field value to.

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.

inline fun <reified T> 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.

Parameters

fieldPath - The path to the field.

T - The type to convert the field value to.

Return
The value at the given field or null.

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

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

Parameters

fieldPath - The path to the field.

T - The type to convert the field value to.

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.