values library Values and codecs

Exact numeric values, calendar values, and explicit storage codecs.

Use Codecs for built-in conversions, or Codec.map to store an application value through an existing codec. No database connection is required.

Classes

Codec<T>
Converts a typed Dart value to database storage and decodes it on reads.
Codecs
Built-in conversions for SQL scalar values, JSON, and exact numeric types.
Decimal
A finite base-ten value, independent of binary floating point.
LocalDate
A Gregorian calendar date, without a time or timezone. Year 0 is 1 BC; negative years use astronomical numbering.
LocalDateTime
Calendar date and wall-clock time, with no timezone or implied UTC instant.
LocalTime
A wall-clock time at microsecond resolution, including the endpoint 24:00. The fourth constructor argument is the full fractional second (0..999999).
SqlJson
A non-SQL-null JSON document. Its value may itself be JSON null. Drivers use this envelope for parsed JSON, including JSON string scalars.
SqlReal
Explicit floating-point SQL input. JavaScript cannot distinguish an integral double from int by runtime type; this preserves the SQL intention.

Enums

DecimalRounding
Rounding is explicit; exact rejects a non-zero discarded remainder.

Extensions

InstantPrecision on DateTime
Explicit precision conversion for resolved UTC instants.

Exceptions / Errors

OrmException
An ORM failure with a stable machine-readable code and optional cause.