com.google.firebase.database
Interfaces
ChildEventListener |
Classes implementing this interface can be used to receive events about changes in the child locations of a given |
DatabaseReference.CompletionListener |
This interface is used as a method of being notified when an operation has been acknowledged by the Database servers and can be considered complete |
Logger |
This interface is used to setup logging for Realtime Database. |
Transaction.Handler |
An object implementing this interface is used to run a transaction, and will be notified of the results of the transaction. |
ValueEventListener |
Classes implementing this interface can be used to receive events about data changes at a location. |
Classes
ChildEvent |
Used to emit events about changes in the child locations of a given |
ChildEvent.Added |
Emitted when a new child is added to the location. |
ChildEvent.Changed |
Emitted when the data at a child location has changed. |
ChildEvent.Moved |
Emitted when a child location's priority changes. |
ChildEvent.Removed |
Emitted when a child is removed from the location. |
DataSnapshot |
A DataSnapshot instance contains data from a Firebase Database location. |
DatabaseError |
Instances of DatabaseError are passed to callbacks when an operation failed. |
DatabaseReference |
A Firebase reference represents a particular location in your Database and can be used for reading or writing data to that Database location. |
FirebaseDatabase |
The entry point for accessing a Firebase Database. |
GenericTypeIndicator |
Due to the way that Java implements generics (type-erasure), it is necessary to use a slightly more complicated method to properly resolve types for generic collections at runtime. |
MutableData |
Instances of this class encapsulate the data and priority at a location. |
OnDisconnect |
The OnDisconnect class is used to manage operations that will be run on the server when this client disconnects. |
Query |
The Query class (and its subclass, |
ServerValue |
Contains placeholder values to use when writing data to the Firebase Database. |
Transaction |
The Transaction class encapsulates the functionality needed to perform a transaction on the data at a location. |
Transaction.Result |
Instances of this class represent the desired outcome of a single run of a |
Exceptions
DatabaseException |
This error is thrown when the Firebase Database library is unable to operate on the input it has been given. |
Annotations
Exclude |
Marks a field as excluded from the Database. |
IgnoreExtraProperties |
Properties that don't map to class fields are ignored when serializing to a class annotated with this annotation. |
PropertyName |
Marks a field to be renamed when serialized. |
ThrowOnExtraProperties |
Properties that don't map to class fields when serializing to a class annotated with this annotation cause an exception to be thrown. |
Enums
Logger.Level |
The log levels used by the Realtime Database library |
Extension functions summary
FirebaseDatabase |
Firebase.database(app: FirebaseApp, url: String) Returns the |
FirebaseDatabase |
Firebase.database(app: FirebaseApp) Returns the |
FirebaseDatabase |
Returns the |
inline T? |
<T : Any?> DataSnapshot.getValue() Returns the content of the DataSnapshot converted to a POJO. |
inline T? |
<T : Any?> MutableData.getValue() Returns the content of the MutableData converted to a POJO. |
inline Flow<T?> |
Starts listening to this query and emits its values converted to a POJO via a |
Extension properties summary
Flow<ChildEvent> |
Starts listening to this query's child events and emits its values via a |
FirebaseDatabase |
Returns the |
Flow<DataSnapshot> |
Starts listening to this query and emits its values via a |
Extension functions
database
fun Firebase.database(app: FirebaseApp, url: String): FirebaseDatabase
Returns the FirebaseDatabase
instance of the given FirebaseApp
and url
.
database
fun Firebase.database(app: FirebaseApp): FirebaseDatabase
Returns the FirebaseDatabase
instance of the given FirebaseApp
.
database
fun Firebase.database(url: String): FirebaseDatabase
Returns the FirebaseDatabase
instance for the specified url
.
getValue
inline fun <T : Any?> DataSnapshot.getValue(): T?
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
.
getValue
inline fun <T : Any?> MutableData.getValue(): T?
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
.
values
inline fun <T : Any> Query.values(): Flow<T?>
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.
Extension properties
childEvents
val Query.childEvents: Flow<ChildEvent>
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.
database
val Firebase.database: FirebaseDatabase
Returns the FirebaseDatabase
instance of the default FirebaseApp
.
snapshots
val Query.snapshots: Flow<DataSnapshot>
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.