dateTime method

  1. @protected
ColumnBuilder<DateTime> dateTime()

Use this as the body of a getter to declare a column that holds date and time values.

Drift supports two modes for storing date times: As unix timestamp with second accuracy (the default) and as ISO 8601 string with microsecond accuracy. For more information between the modes, and information on how to change them, see the documentation.

Note that DateTime values are stored on a second-accuracy. Example (inside the body of a table class):

DateTimeColumn get accountCreatedAt => dateTime()();

dateTime columns are optimized for SQLite. When using drift with another database, such as PostgreSQL, use native datetime columns.

Implementation

@protected
ColumnBuilder<DateTime> dateTime() => _isGenerated();