DatabaseEvent class final
An event from one of the on<Thing> streams of a Query, or from Query.once.
One class serves every kind: switch on type.
await for (final DatabaseEvent e in db.ref('rooms/1/messages').onChildEvents) {
switch (e.type) {
case DatabaseEventType.childAdded:
print('added ${e.snapshot.key} after ${e.previousChildKey}');
case DatabaseEventType.childRemoved:
print('removed ${e.snapshot.key}');
default:
break;
}
}
- Annotations
Constructors
- DatabaseEvent({required DatabaseEventType type, required DataSnapshot snapshot, String? previousChildKey})
-
Creates an event of
typewithsnapshot, for a fake or a test; the client's own events come from the streams ofQuery.previousChildKeyfollows the rules of the field.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- previousChildKey → String?
-
The key of the child before snapshot in the query's order, for DatabaseEventType.childAdded,
DatabaseEventType.childChanged and DatabaseEventType.childMoved; null for the first child and for
every other kind.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- snapshot → DataSnapshot
-
The data of the event.
final
- type → DatabaseEventType
-
The kind of event.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited