Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Last active Dec 3, 2021
Embed
What would you like to do?
file addLine "return \"$route${if (propertyMap.isNotEmpty()) "?" else ""}\" + "
tabs++
tabs++
count = 0
properties.forEach { property ->
count++
val propertyInfo = propertyMap[property] ?: run {
logger.error("Invalid type argument", property)
return
}
val argumentName = propertyInfo.propertyName
file addLine "\"$argumentName="
file addPhrase when (propertyInfo.composeArgumentType) {
ComposeArgumentType.INT,
ComposeArgumentType.BOOLEAN,
ComposeArgumentType.LONG,
ComposeArgumentType.FLOAT,
ComposeArgumentType.STRING -> "$$argumentName"
else -> "\${Uri.encode(gson.toJson($argumentName))}"
}
if (count == propertyMap.size) {
file addPhrase "\""
} else {
file addPhrase ",\""
}
file addPhrase " + "
}
file addLine "\"\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment