currentDate top-level constant Null safety

Expression<DateTime> const currentDate

A sql expression that evaluates to the current date.

Depending on whether date times are stored as unix timestamps (the default) or as text on the database, this returns a unix timestamp or a string. In either case, the hour, minute and second fields will be set to null. Note that in the case where a formatted string is returned, the format will write the value in UTC.

Implementation

const Expression<DateTime> currentDate = _DependingOnDateTimeExpression(
  forIsoString: _currentDateLiteral,
  forTimestamps: _DartCastExpression(
    FunctionCallExpression(
      'strftime',
      [Constant('%s'), _currentDateLiteral],
    ),
  ),
);