DatabaseKt

public final class DatabaseKt


Summary

Public fields

final @NonNull Flow<@NonNull ChildEvent>

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

final @NonNull FirebaseDatabase

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

final @NonNull Flow<@NonNull DataSnapshot>

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

Public methods

static final @NonNull FirebaseDatabase

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

static final @NonNull FirebaseDatabase

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

static final @NonNull FirebaseDatabase
DatabaseKt.database(
    @NonNull Firebase receiver,
    @NonNull FirebaseApp app,
    @NonNull String url
)

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

static final T
<T extends Object> DatabaseKt.getValue(@NonNull DataSnapshot receiver)

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> DatabaseKt.getValue(@NonNull MutableData receiver)

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<T>
<T extends Object> DatabaseKt.values(@NonNull Query receiver)

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

Public fields

childEvents

public final @NonNull Flow<@NonNull ChildEventchildEvents

Starts listening to this query's child events and emits its values via a Flow.

  • When the returned flow starts being collected, a ChildEventListener 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.

database

public final @NonNull FirebaseDatabase database

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

Returns the FirebaseDatabase 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.

snapshots

public final @NonNull Flow<@NonNull DataSnapshotsnapshots

Starts listening to this query and emits its values via a Flow.

  • When the returned flow starts being collected, a ValueEventListener 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.

Public methods

DatabaseKt.database

public static final @NonNull FirebaseDatabase DatabaseKt.database(@NonNull Firebase receiver, @NonNull FirebaseApp app)

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

Returns the FirebaseDatabase instance of the 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.

DatabaseKt.database

public static final @NonNull FirebaseDatabase DatabaseKt.database(@NonNull Firebase receiver, @NonNull String url)

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

Returns the FirebaseDatabase instance for the specified url.

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.

DatabaseKt.database

public static final @NonNull FirebaseDatabase DatabaseKt.database(
    @NonNull Firebase receiver,
    @NonNull FirebaseApp app,
    @NonNull String url
)

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

Returns the FirebaseDatabase instance of the given FirebaseApp and url.

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.

DatabaseKt.getValue

public static final T <T extends Object> DatabaseKt.getValue(@NonNull DataSnapshot receiver)

Returns the content of the DataSnapshot converted to a POJO.

Supports generics like List<> or Map<>. Use @JvmSuppressWildcards to force the compiler to use the type T, and not ? extends T.

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.

DatabaseKt.getValue

public static final T <T extends Object> DatabaseKt.getValue(@NonNull MutableData receiver)

Returns the content of the MutableData converted to a POJO.

Supports generics like List<> or Map<>. Use @JvmSuppressWildcards to force the compiler to use the type T, and not ? extends T.

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.

DatabaseKt.values

public static final @NonNull Flow<T> <T extends Object> DatabaseKt.values(@NonNull Query receiver)

Starts listening to this query and emits its values converted to a POJO via a Flow.

  • When the returned flow starts being collected, a ValueEventListener 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.