FirebaseTimestamp class

A virtual timestamp that can either be a DateTime or a server set value.

If you want to use a server timestamp for a database entry, you should use this class instead of DateTime. It can be either set to a date time, allowing you to set an actual time, or to FirebaseTimestamp.server, which is a placeholder that will be replaced by the server time upon beeing stored.

Annotations
  • @freezed

Constructors

FirebaseTimestamp(DateTime value)
Creates a timestamp from a DateTime value.
const
factory
FirebaseTimestamp.server()
Creates a timestamp placeholder that will be set to an actual DateTime upon beeing stored on the server.
const
factory

Properties

dateTime DateTime
Returns the datetime value of the timestamp.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_FirebaseTimestamp value), {required TResult server(_Server value)}) → TResult
inherited
maybeMap<TResult extends Object?>(TResult $default(_FirebaseTimestamp value)?, {TResult server(_Server value)?, required TResult orElse()}) → TResult
inherited
maybeWhen<TResult extends Object?>(TResult $default(DateTime value)?, {TResult server()?, required TResult orElse()}) → TResult
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(DateTime value), {required TResult server()}) → TResult
inherited

Operators

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