DatabaseReference class abstract

DatabaseReference represents a particular location in your Firebase Database and can be used for reading or writing data to that location.

This class is the starting point for all Firebase Database operations. After you’ve obtained your first DatabaseReference via FirebaseDatabase.reference(), you can use it to read data (ie. onChildAdded), write data (ie. setValue), and to create new DatabaseReferences (ie. child).

Implemented types

Constructors

DatabaseReference()

Properties

hashCode int
The hash code for this object.
no setterinherited
key String?
Gets the last token in a Firebase Database location (e.g. ‘fred’ in https://SampleChat.firebaseIO-demo.com/users/fred)
no setter
onChildAdded Stream<Event>
Streams for 'child_added' events.
no setterinherited
onChildChanged Stream<Event>
Streams for 'child_changed' events.
no setterinherited
onChildMoved Stream<Event>
Streams for 'child_moved' events.
no setterinherited
onChildRemoved Stream<Event>
Streams for 'child_removed' events.
no setterinherited
onValue Stream<Event>
Streams for 'value' events.
no setterinherited
path String
Gets the path to this Firebase reference's location.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url Uri
Gets the absolute URL corresponding to this Firebase reference's location.
no setter

Methods

child(String c) DatabaseReference
Gets a DatabaseReference for the location at the specified relative path.
endAt(dynamic value, {String? key}) Query
Creates a Query with the specified ending point. The generated Query includes children which match the specified ending point. If no arguments are provided, the ending point will be the end of the data.
inherited
equalTo(dynamic value, {String? key}) Query
Creates a Query which includes children which match the specified value.
inherited
get() Future
Convenient method to get the value for this query.
inherited
keepSynced(bool value) Future<void>
By calling keepSynced(true) on a location, the data for that location will automatically be downloaded and kept in sync, even when no listeners are attached for that location.
inherited
limitToFirst(int limit) Query
Generates a new Query object limited to the first certain number of children.
inherited
limitToLast(int limit) Query
Generates a new Query object limited to the last certain number of children.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on(String eventType) Stream<Event>
Gets a stream for events of type eventType
inherited
once() Future<DataSnapshot>
Listens for a single value event and then stops listening.
inherited
onDisconnect() OnDisconnect
Getter for onDisconnect.
orderByChild(String child) Query
Generates a new Query object ordered by the specified child key.
inherited
orderByKey() Query
Generates a new Query object ordered by key.
inherited
orderByPriority() Query
Generates a new Query object ordered by priority.
inherited
orderByValue() Query
Generates a new Query object ordered by child values.
inherited
parent() DatabaseReference?
Gets a DatabaseReference for the parent location.
push() DatabaseReference
Generates a new child location using a unique key and returns a DatabaseReference to it. This is useful when the children of a Firebase Database location represent a list of items.
reference() DatabaseReference
Queries are attached to a location in your Firebase. This method will return a Firebase reference to that location.
inherited
remove() Future<void>
Remove the data at this Firebase location. Any data at child locations will also be deleted.
root() DatabaseReference
Gets a DatabaseReference for the root location.
runTransaction(TransactionHandler transactionHandler, {Duration timeout = const Duration(seconds: 5)}) Future<TransactionResult>
Atomically modify the data at this location. Unlike a normal set(), which just overwrites the data regardless of its previous value, runTransaction() is used to modify the existing value to a new value, ensuring there are no conflicts with other clients writing to the same location at the same time.
set(dynamic value, {dynamic priority}) Future<void>
Write value to the location with the specified priority if applicable.
setPriority(dynamic priority) Future<void>
Sets a priority for the data at this Firebase Database location.
startAt(dynamic value, {String? key}) Query
Creates a Query with the specified starting point. The generated Query includes children which match the specified starting point. If no arguments are provided, the starting point will be the beginning of the data.
inherited
toString() String
A string representation of this object.
inherited
update(Map<String, dynamic> value) Future<void>
Write the enumerated children to this Firebase location. This will only overwrite the children enumerated in the 'value' parameter and will leave others untouched.

Operators

operator ==(Object other) bool
The equality operator.
inherited