ea static method
Implementation
static Object? ea(Object? o) {
_;
for ((Type, Type) i in $artifactCodecs.keys) {
if (i.$2 == o.runtimeType) {
return $artifactCodecs[i]?.encode(o);
}
}
if (!$isPrimitive(o)) {
warn(
"=====================================================================================================================================================",
);
warn(
"[ARTIFACT] Missing Codec for encoding ${o.runtimeType}. Use @codec(${o.runtimeType}Codec()) on the field or on the class to teach Artifact how to handle ${o.runtimeType} classes.",
);
warn(
"[ARTIFACT] To convert, your class should extend ArtifactCodec<PRIMITIVE, ${o.runtimeType}>. Make sure it has an empty const constructor. ",
);
warn(
"[ARTIFACT] I.e. `class ${o.runtimeType}Codec extends ArtifactCodec<String, ${o.runtimeType}>` if it can convert to/from strings easily.",
);
warn(
"[ARTIFACT] Then put @codec(${o.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 o;
}