ea static method
Implementation
static Object? ea(Object? value) {
_;
for ((Type, Type) key in $artifactCodecs.keys) {
if (key.$2 == value.runtimeType) {
return $artifactCodecs[key]?.encode(value);
}
}
if (!$isPrimitive(value)) {
warn(
"=====================================================================================================================================================",
);
warn(
"[ARTIFACT] Missing Codec for encoding ${value.runtimeType}. Use @codec(${value.runtimeType}Codec()) on the field or on the class to teach Artifact how to handle ${value.runtimeType} classes.",
);
warn(
"[ARTIFACT] To convert, your class should extend ArtifactCodec<PRIMITIVE, ${value.runtimeType}>. Make sure it has an empty const constructor. ",
);
warn(
"[ARTIFACT] I.e. `class ${value.runtimeType}Codec extends ArtifactCodec<String, ${value.runtimeType}>` if it can convert to/from strings easily.",
);
warn(
"[ARTIFACT] Then put @codec(${value.runtimeType}Codec()) on any field of any artifact model, OR on any field of any artifact class.",
);
warn(
"[ARTIFACT] You also don't need to worry about lists or maps, just handle the specific type and put the codec anywhere.",
);
warn(
"=====================================================================================================================================================",
);
}
return value;
}