currentTimestamp constant

Expr<DateTime> const currentTimestamp

Get an Expr<DateTime> that represents the current timestamp in UTC.

This Expr<DateTime> will be evaluated in the database. Semantically, it's supposed to be equivalent to:

final currentTimestamp = toExpr(DateTime.now());

where toExpr will normalize DateTime values to UTC.

However, in practice many databases will render timestamps with fewer decimals than DateTime.now() in Dart.

This is mainly intended if you want to use the database clock. For example, this is how DefaultValue.now is encoded.

Implementation

static const Expr<DateTime> currentTimestamp =
    CurrentTimestampExpression.currentTimestamp;