infer<V> static method
Infers a codec for common types: int, double, num, bool,
String, DateTime and their nullable variants.
int/double decode leniently from any num; DateTime decodes from
a DateTime, an epoch-milliseconds int, or an ISO-8601 String
(bridging stores that persist either form) and encodes as ISO-8601.
Throws ArgumentError for any other V — pass an explicit codec:
(e.g. enumByName, jsonObject) for those.
Implementation
static DatumFieldCodec<V> infer<V>() {
final inferred = _tryInfer<V>();
if (inferred == null) {
throw ArgumentError(
'No built-in codec for $V. Pass an explicit codec: '
'(DatumFieldCodec.enumByName / jsonObject / a custom DatumFieldCodec).',
);
}
return inferred;
}