DatumFieldCodec<V> class abstract

Converts between a Dart value of type V and its persisted form.

Constructors

DatumFieldCodec()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
nullable DatumFieldCodec<V?>
A null-passthrough wrapper for nullable field types (DatumFieldCodec.dateTimeIso.nullable for a DateTime? field).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(Object? raw) → V
Decodes a raw persisted value back into a V.
encode(V value) Object?
Encodes value into a JSON/map-friendly representation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

enumByName<T extends Enum>(List<T> values) DatumFieldCodec<T>
Enums persisted by .name (matching datum_generator).
infer<V>() DatumFieldCodec<V>
Infers a codec for common types: int, double, num, bool, String, DateTime and their nullable variants.
jsonObject<T>(T fromJson(Map<String, dynamic> json), Map<String, dynamic> toJson(T value)) DatumFieldCodec<T>
Nested objects persisted as JSON maps.

Constants

bigInt → const DatumFieldCodec<BigInt>
BigInt as its decimal string form.
dateTimeEpochMillis → const DatumFieldCodec<DateTime>
Epoch milliseconds on encode; same lenient decode as dateTimeIso.
dateTimeIso → const DatumFieldCodec<DateTime>
ISO-8601 strings on encode; lenient decode (DateTime, epoch-ms int, ISO-8601 string).
durationMicros → const DatumFieldCodec<Duration>
Duration as microseconds.
uri → const DatumFieldCodec<Uri>
Uri as its string form.