The kotlinpoet channel is archived so I assumed on...
# squarelibraries
j
The kotlinpoet channel is archived so I assumed one should use this channel to ask a questions? I’m trying to implement a
fun interface
but the generated code is using a`:` instead of a
=
like so :
Copy code
public fun <AsyncDataType, LoadEvent> loadAsyncData(
    key: TransitionKey,
    loader: (LoadEvent) -> AsyncDataType
): ReusableTransition<LoadEvent> { updater, event ->
    ...
}
I use the following code to generate it
Copy code
FunSpec.builder("loadAsyncData")
    .addTypeVariable(asyncDataType)
    .addTypeVariable(loadEvent)
    .addParameter("key", TransitionKeyGenerator.className)
    .addParameter("loader", loader)
    .returns(reusableTransition)
    .addCode(
        CodeBlock.builder()
            .add(...)
            .build()
    ).build()
g
afair,
returns()
is for the return type. You can return from the
addCode