Hello, is there a good "Kotlin way" of writing thi...
# announcements
p
Hello, is there a good "Kotlin way" of writing this kind of stuff :
Copy code
return HttpUrl.Builder()
    .addQueryParameter(PARAMETER_CARD_ID, param.cardId)
    .apply {
        if (param.promoCode.isBlank().not()) {
            addQueryParameter(OkHttpCardUpgradePriceDataSource.PARAMETER_PROMOCODE, param.promoCode)
        }
    }
    .build()
I don't want to break the fluent builder but having to call
apply
then
if
inside doesn't seems right to me. Any better ideas ?