DatumFieldSpec<E, V> class
A full runtime descriptor for one serialized field of entity E with
Dart value type V.
Declared once per field as static final (the codec/getter closures rule
out const), the same declare-once pattern as MemoizedRelations:
abstract final class TaskFields {
static final title = DatumFieldSpec<Task, String>('title', getter: (t) => t.title);
static final priority = DatumFieldSpec<Task, int>('priority',
getter: (t) => t.priority, defaultValue: 0, renamedFrom: 'prio');
}
// Everything DatumQueryField offers still works:
final query = DatumQueryBuilder<Task>().whereField(TaskFields.priority, isGreaterThan: 2).build();
- Inheritance
-
- Object
- DatumQueryField<
E, V> - DatumFieldSpec
Constructors
-
DatumFieldSpec(String name, {DatumFieldGetter<
E, V> ? getter, DatumFieldCodec<V> ? codec, String? sqlType, V? defaultValue, String? renamedFrom, DatumCoreRole? coreRole})
Properties
-
codec
→ DatumFieldCodec<
V> -
Converts between
Vand the persisted representation.final - coreRole → DatumCoreRole?
-
Marks one of the six standard sync fields (set by
datumCoreFieldSpecs); null for payload fields.
DatumSchema.diffOf/propsOfuse it to separate payload from sync metadata.final - defaultValue → V?
-
Backfill value auto-migration uses when adding this column to existing
rows. Required (or isNullable) for a field to be auto-addable.
final
-
getter
→ DatumFieldGetter<
E, V> ? -
Extracts this field's value from an entity; required for
DatumSchema.toMapdelegation, optional otherwise.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isNotNull → Filter
-
field IS NOT NULLno setterinherited - isNull → Filter
-
field IS NULLno setterinherited - isNullable → bool
-
Whether
Vadmits null.no setter - name → String
-
The serialized field name (map key / column), supporting dot notation.
finalinherited
- renamedFrom → String?
-
The previous serialized name of this field. Auto-migration treats a
store that has renamedFrom but not name as a rename instead of a
drop + add (which would lose data).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sqlType → String?
-
Explicit SQL column type (e.g.
'TEXT'); wins over resolveSqlType's derivation.final - valueType → Type
-
The Dart value type of this field.
no setter
Methods
-
decode(
Object? raw) → V -
Decodes
rawwith codec, wrapping any failure in a SchemaReadException that names this field. -
encode(
V value) → Object? -
Encodes
valuewith codec. -
equalTo(
V value) → Filter -
field == valueinherited -
greaterThan(
V value) → Filter -
field > valueinherited -
greaterThanOrEqual(
V value) → Filter -
field >= valueinherited -
isIn(
List< V> values) → Filter -
field IN valuesinherited -
isNotIn(
List< V> values) → Filter -
field NOT IN valuesinherited -
lessThan(
V value) → Filter -
field < valueinherited -
lessThanOrEqual(
V value) → Filter -
field <= valueinherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notEqualTo(
V value) → Filter -
field != valueinherited -
resolveSqlType(
{SqlDialect dialect = SqlDialect.sqlite}) → String -
The SQL column type for this field: sqlType when given, else derived
from
V(int→INTEGER, double→REAL / DOUBLE PRECISION, num→NUMERIC, bool→BOOLEAN, String/DateTime/Uri/BigInt→TEXT, Duration→INTEGER). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited