asArgumentList

fun List<Parameter>.asArgumentList(asProvider: Boolean, includeModule: Boolean): String

Converts the parameter list to comma separated argument list that can be used to call other functions, e.g.

[param0: String, param1: Int] -> "param0, param1"

asProvider allows you to decide if each parameter is wrapped in a Provider interface. If true, then the get() function will be called for the provider parameter. If false, then then always only the parameter name will used in the argument list:

"param0.get()" vs "param0"

Set includeModule to true if a Dagger module instance is part of the argument list.

Sources

Link copied to clipboard