DatumSchemaReader<E extends DatumEntityInterface> class
final
Reads field values out of one raw map with precise, field-named errors —
the as-cast-free way to implement fromMap:
factory Task.fromMap(Map<String, dynamic> map) {
final r = taskSchema.reader(map);
return Task(id: r(idField), title: r(TaskFields.title), due: r.maybe(TaskFields.due));
}
Constructors
-
DatumSchemaReader(String schemaName, Map<
String, dynamic> raw)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
raw
→ Map<
String, dynamic> -
The raw map being read.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schemaName → String
-
The owning schema's name, used in error messages.
final
Methods
-
call<
V> (DatumFieldSpec< E, V> field) → V -
Shorthand for get:
r(TaskFields.title). -
get<
V> (DatumFieldSpec< E, V> field) → V -
The decoded value of
field; throws SchemaReadException on a missing key (for non-nullable fields), a null value, or a decode failure. -
getOr<
V> (DatumFieldSpec< E, V> field, V fallback) → V -
Like get, but returns
fallbackwhen the key is absent or null. -
maybe<
V> (DatumFieldSpec< E, V> field) → V? - Like get, but returns null when the key is absent or null.
-
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