encoder

val encoder: (T) -> List<Any>

Function that decomposes objects into serializable components.

This function is called during serialization to convert objects of type T into a list of primitive values that can be serialized using the componentSchemas. The returned list must:

  • Have the same number of elements as componentSchemas

  • Contain values compatible with the corresponding schemas

  • Be deterministic (same object should always produce the same components)

Performance Note: This function is called twice during serialization - once for size calculation and once for actual encoding. Avoid expensive computations or consider caching results if the same object is serialized multiple times.