ServerValue class abstract final

Values the server fills in when it applies a write.

Use them anywhere in a value passed to DatabaseReference.set, DatabaseReference.update, a transaction or an OnDisconnect write, and as a priority. Until the server answers, local events show an estimate made from the client's clock and the server time offset.

await db.ref('posts/1').update(<String, Object?>{
  'updatedAt': ServerValue.timestamp,
  'views': ServerValue.increment(1),
});

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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

Static Methods

increment(num delta) → Object
Adds delta to the number stored at the location when the server applies the write: the placeholder {'.sv': {'increment': delta}}. A location that holds no number is treated as 0. A NaN or infinite delta is not checked here: the write that holds it throws an ArgumentError.

Constants

timestamp → const Object
The time the server applied the write, in milliseconds since the epoch: the placeholder {'.sv': 'timestamp'}.