com.google.firebase.dataconnect

Interfaces

DataConnectOperationFailureResponse

The data and errors provided by the backend in the response message.

DataConnectOperationFailureResponse.ErrorInfo

Information about the error, as provided in the response payload from the backend.

DataConnectPathSegment

The "segment" of a path to a field in the response data.

EnumValue

Stores the value of anenum or a string if the string does not correspond to one of the enum's values.

FirebaseDataConnect

Firebase Data Connect is Firebase's first relational database solution for app developers to build mobile and web applications using a fully managed PostgreSQL database powered by Cloud SQL.

FirebaseDataConnect.MutationRefOptionsBuilder

Options that can be specified when creating aMutationRef via themutation method.

FirebaseDataConnect.QueryRefOptionsBuilder

Options that can be specified when creating aQueryRef via thequery method.

MutationRef

A specialization ofOperationRef formutation operations.

MutationResult

A specialization ofOperationResult forMutationRef.

OperationRef

Information about a Firebase Data Connect "operation" (a query or a mutation).

OperationResult

The result of a successful execution of anOperationRef.

OptionalVariable

An optional variable to a query or a mutation.

QueryRef

A specialization ofOperationRef forquery operations.

QueryResult

A specialization ofOperationResult forQueryRef.

QuerySubscription

A facility to subscribe to a query to be notified of updates to the query's data when the query is executed.

QuerySubscriptionResult

The result of a query's execution, as notified to aQuerySubscription.

Classes

AnyValue

Represents a variable or field of the Data Connect custom scalar typeAny.

ConnectorConfig

Information about a Firebase Data Connect "connector" that is used byFirebaseDataConnect to connect to the correct Google Cloud resources.

DataConnectPathSegment.Field

A named field in a path to a field in the response data.

DataConnectPathSegment.ListIndex

An index of a list in a path to a field in the response data.

DataConnectSettings

Settings that control the behavior ofFirebaseDataConnect instances.

EnumValue.Known

Represents a known enum value.

EnumValue.Unknown

Represents an unknown enum value.

LocalDate

A date without a time-zone in the ISO-8601 calendar system, such as2007-12-03.

OptionalVariable.Serializer

TheKSerializer implementation forOptionalVariable.

OptionalVariable.Value

An implementation ofOptionalVariable representing a "defined" value.

Exceptions

DataConnectException

The exception thrown when an error occurs in Firebase Data Connect.

DataConnectOperationException

The exception thrown when an error occurs in the execution of a Firebase Data Connect operation (that is, a query or mutation).

Objects

OptionalVariable.Undefined

An implementation ofOptionalVariable representing an "undefined" value.

Annotations

ExperimentalFirebaseDataConnect

Marks declarations in the Firebase Data Connect SDK that areexperimental.

Enums

FirebaseDataConnect.CallerSdkType

A tag used for analytics purposes to track the source of usages of the Firebase Data Connect product.

LogLevel

The log levels supported byFirebaseDataConnect.

Extension functions summary

ConnectorConfig
ConnectorConfig.copy(
    connector: String,
    location: String,
    serviceId: String
)

Creates and returns a newConnectorConfig instance with the given property values.

DataConnectSettings
DataConnectSettings.copy(host: String, sslEnabled: Boolean)

Creates and returns a newDataConnectSettings instance with the given property values.

LocalDate
LocalDate.copy(year: Int, month: Int, day: Int)

Creates and returns a newLocalDate instance with the given property values.

inline T
<T : Any?>AnyValue.decode()

Decodes the encapsulated value using thedefault serializer for the return type, as computed byserializer.

T
<T : Any?>AnyValue.decode(
    deserializer: DeserializationStrategy<T>,
    serializersModule: SerializersModule?
)

Decodes the encapsulated value using the given deserializer.

AnyValue
<T : Any?>AnyValue.Companion.encode(
    value: T,
    serializer: SerializationStrategy<T>,
    serializersModule: SerializersModule?
)

Encodes the given value using the given serializer to anAnyValue object, and returns it.

inlineAnyValue
<T : Any?>AnyValue.Companion.encode(value: T)

Encodes the given value using the givendefault serializer for the given object, as computed byserializer.

AnyValue

Creates and returns anAnyValue object created using theAnyValue constructor that corresponds to the runtime type of the given value.

AnyValue?

Creates and returns anAnyValue object created using theAnyValue constructor that corresponds to the runtime type of the given value, or returnsnull if the given value isnull.

FirebaseDataConnect

Returns the instance ofFirebaseDataConnect associated with the givenFirebaseApp andConnectorConfig, creating theFirebaseDataConnect instance if necessary.

FirebaseDataConnect

Returns the instance ofFirebaseDataConnect associated with the defaultFirebaseApp and the givenConnectorConfig, creating theFirebaseDataConnect instance if necessary.

LocalDate

Creates and returns aLocalDate object that represents the same date as thisjava.time.LocalDate object.

LocalDate

Creates and returns aLocalDate object that represents the same date as the givenkotlinx.datetime.LocalDate object.

LocalDate

Creates and returns ajava.time.LocalDate object that represents the same date as this object.

LocalDate

Creates and returns akotlinx.datetime.LocalDate object that represents the same date as this object.

Extension properties summary

Extension functions

copy

fun ConnectorConfig.copy(
    connector: String = this.connector,
    location: String = this.location,
    serviceId: String = this.serviceId
): ConnectorConfig

Creates and returns a newConnectorConfig instance with the given property values.

copy

fun DataConnectSettings.copy(
    host: String = this.host,
    sslEnabled: Boolean = this.sslEnabled
): DataConnectSettings

Creates and returns a newDataConnectSettings instance with the given property values.

copy

fun LocalDate.copy(year: Int = this.year, month: Int = this.month, day: Int = this.day): LocalDate

Creates and returns a newLocalDate instance with the given property values.

decode

inline fun <T : Any?>AnyValue.decode(): T

Decodes the encapsulated value using thedefault serializer for the return type, as computed byserializer.

Returns
T

the object of typeT created by decoding the encapsulated value using thedefault serializer for the return type, as computed byserializer.

decode

fun <T : Any?>AnyValue.decode(
    deserializer: DeserializationStrategy<T>,
    serializersModule: SerializersModule? = null
): T

Decodes the encapsulated value using the given deserializer.

Parameters
deserializer: DeserializationStrategy<T>

The deserializer for the decoder to use.

serializersModule: SerializersModule? = null

aSerializersModule to use during deserialization; may benull (the default) tonot use aSerializersModule to use during deserialization.

Returns
T

the object of typeT created by decoding the encapsulated value using the given deserializer.

encode

fun <T : Any?>AnyValue.Companion.encode(
    value: T,
    serializer: SerializationStrategy<T>,
    serializersModule: SerializersModule? = null
): AnyValue

Encodes the given value using the given serializer to anAnyValue object, and returns it.

Parameters
value: T

the value to serialize.

serializer: SerializationStrategy<T>

the serializer for the encoder to use.

serializersModule: SerializersModule? = null

aSerializersModule to use during serialization; may benull (the default) tonot use aSerializersModule to use during serialization.

Returns
AnyValue

a newAnyValue object whose encapsulated value is the encoding of the given value when decoded with the given serializer.

encode

inline fun <T : Any?>AnyValue.Companion.encode(value: T): AnyValue

Encodes the given value using the givendefault serializer for the given object, as computed byserializer.

Parameters
value: T

the value to serialize.

Returns
AnyValue

a newAnyValue object whose encapsulated value is the encoding of the given value when decoded with thedefault serializer for the given object, as computed byserializer.

fromAny

fun AnyValue.Companion.fromAny(value: Any): AnyValue

Creates and returns anAnyValue object created using theAnyValue constructor that corresponds to the runtime type of the given value.

Throws
kotlin.IllegalArgumentException: kotlin.IllegalArgumentException

if the given value is not supported byAnyValue; see theAnyValue constructor for details.

fromAny

fun AnyValue.Companion.fromAny(value: Any?): AnyValue?

Creates and returns anAnyValue object created using theAnyValue constructor that corresponds to the runtime type of the given value, or returnsnull if the given value isnull.

Throws
kotlin.IllegalArgumentException: kotlin.IllegalArgumentException

if the given value is not supported byAnyValue; see theAnyValue constructor for details.

getInstance

fun FirebaseDataConnect.Companion.getInstance(
    app: FirebaseApp,
    config: ConnectorConfig,
    settings: DataConnectSettings = DataConnectSettings()
): FirebaseDataConnect

Returns the instance ofFirebaseDataConnect associated with the givenFirebaseApp andConnectorConfig, creating theFirebaseDataConnect instance if necessary.

The instances ofFirebaseDataConnect are keyed from the givenFirebaseApp, using the identity comparison operator===, and the givenConnectorConfig, using the equivalence operator==. That is, the first invocation of this method with a givenFirebaseApp andConnectorConfig will create and return a newFirebaseDataConnect instance that is associated with those objects. A subsequent invocation with the sameFirebaseApp object and an equalConnectorConfig will return the sameFirebaseDataConnect instance that was returned from the previous invocation.

If a newFirebaseDataConnect instance is created, it will use the givenDataConnectSettings. If an existing instance will be returned, then the given (or default)DataConnectSettings must be equal to theFirebaseDataConnect.settings of the instance about to be returned; otherwise, an exception is thrown.

Parameters
app: FirebaseApp

TheFirebaseApp instance with which the returned object is associated.

config: ConnectorConfig

TheConnectorConfig with which the returned object is associated.

settings: DataConnectSettings = DataConnectSettings()

TheDataConnectSettings for the returned object to use.

Returns
FirebaseDataConnect

TheFirebaseDataConnect instance associated with the givenFirebaseApp andConnectorConfig, using the givenDataConnectSettings.

getInstance

fun FirebaseDataConnect.Companion.getInstance(
    config: ConnectorConfig,
    settings: DataConnectSettings = DataConnectSettings()
): FirebaseDataConnect

Returns the instance ofFirebaseDataConnect associated with the defaultFirebaseApp and the givenConnectorConfig, creating theFirebaseDataConnect instance if necessary.

This method is a shorthand for callingFirebaseDataConnect.getInstance(Firebase.app, config) orFirebaseDataConnect.getInstance(Firebase.app, config, settings). See the documentation of that method for full details.

Parameters
config: ConnectorConfig

TheConnectorConfig with which the returned object is associated.

settings: DataConnectSettings = DataConnectSettings()

TheDataConnectSettings for the returned object to use.

Returns
FirebaseDataConnect

TheFirebaseDataConnect instance associated with the defaultFirebaseApp and the givenConnectorConfig, using the givenDataConnectSettings.

toDataConnectLocalDate

fun LocalDate.toDataConnectLocalDate(): LocalDate

Creates and returns aLocalDate object that represents the same date as thisjava.time.LocalDate object. This is the inverse operation ofLocalDate.toJavaLocalDate.

Be sure toonly call this method ifjava.time.LocalDate is available. See the documentation forLocalDate.toJavaLocalDate for details.

toDataConnectLocalDate

fun LocalDate.toDataConnectLocalDate(): LocalDate

Creates and returns aLocalDate object that represents the same date as the givenkotlinx.datetime.LocalDate object. This is the inverse operation oftoKotlinxLocalDate.

Be sure toonly call this method if your application has a dependency onorg.jetbrains.kotlinx:kotlinx-datetime. See the documentation fortoKotlinxLocalDate for details.

toJavaLocalDate

fun LocalDate.toJavaLocalDate(): LocalDate

Creates and returns ajava.time.LocalDate object that represents the same date as this object.

Be sure toonly call this method ifjava.time.LocalDate is available; otherwise the behavior is undefined. If your application'sminSdkVersion is greater than or equal to26, or if you have configured"desugaring" then it is guaranteed to be available. Otherwise, checkandroid.os.Build.VERSION.SDK_INT at runtime and verify that its value is at leastandroid.os.Build.VERSION_CODES.O before calling this method.

toKotlinxLocalDate

fun LocalDate.toKotlinxLocalDate(): LocalDate

Creates and returns akotlinx.datetime.LocalDate object that represents the same date as this object.

Be sure toonly call this method if your application has a dependency onorg.jetbrains.kotlinx:kotlinx-datetime; otherwise, the behavior of this method is undefined. If yourminSdkVersion is less than26 then youmay also need to configure"desugaring".

Extension properties

logLevel

val FirebaseDataConnect.Companion.logLevelMutableStateFlow<LogLevel>

The log level used by allFirebaseDataConnect instances.

As aMutableStateFlow, the log level can be changed by assigningMutableStateFlow.value. Also, the flow can be "collected" as a means of observing the log level, which may be useful in the case that a user interface shows a UI element, such as a checkbox, to represent whether debug logging is enabled.

The default log level isLogLevel.WARN. Setting this toLogLevel.DEBUG will enable debug logging, which is especially useful when reporting issues to Google or investigating problems yourself. Setting it toLogLevel.NONE will disable all logging.

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-10-09 UTC.