ServerTimestamp 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 the server timestamp, which is a placeholder that will be replaced by the server time upon being stored.
Important: To use the ServerTimestamp, it must be registered with hive. See ServerTimestampHiveAdapter for details on how to do that.
- Annotations
-
- @freezed
Constructors
- ServerTimestamp.server()
-
Creates a timestamp placeholder that will be set to an actual DateTime
upon being stored on the server.
constfactory
- ServerTimestamp.value(DateTime value)
-
Creates a timestamp from a DateTime
value
.factory
Properties
Methods
-
map<
TResult extends Object?> ({required TResult server(_Server value), required TResult value(_Value value)}) → TResult -
inherited
-
mapOrNull<
TResult extends Object?> ({TResult server(_Server value)?, TResult value(_Value value)?}) → TResult? -
inherited
-
maybeMap<
TResult extends Object?> ({TResult server(_Server value)?, TResult value(_Value value)?, required TResult orElse()}) → TResult -
inherited
-
maybeWhen<
TResult extends Object?> ({TResult server()?, TResult value(DateTime value)?, 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?> ({required TResult server(), required TResult value(DateTime value)}) → TResult -
inherited
-
whenOrNull<
TResult extends Object?> ({TResult server()?, TResult value(DateTime value)?}) → TResult? -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited