Release 5.2.1 - Kotlin API for Value Slots with idiomatic forEach and forEachIndexed
· One min read
This release adds Kotlin extensions for more ergonomic list rendering with HtmlFlow Value Slots. The new APIs support ordinary and indexed iteration while preserving existing engine behavior and compatibility.
Kotlin list rendering with Value Slots
Templates can now use Element<T, Z>.forEachOf(...) and
Element<T, Z>.forEachIndexedOf(...) to render repeated content with an
idiomatic Kotlin API.
The extensions include:
- Overloads with an explicit extractor from a model to
Iterable<E>. - Convenience overloads for models that are already
Iterable<E>. - Indexed iteration through
Slot<Indexed<E>>for templates that need each item's position.
The behavior aligns with the Java-side forEachOf and forEachIndexedOf
methods, including nested loops and conditionals. This lets you write cleaner
Kotlin templates with less boilerplate while retaining repeatable renders and
the same rendering guarantees.