https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

megamiun

03/08/2018, 5:16 AM
It seems I can use default on the declaration. What I cant do is call the function with the named parameters
a

albertgao

03/08/2018, 5:21 AM
Thanks for the tip. Seems fine for the class. But not the case for a function. Expected declaration can’t have parameters with default value. If I do something like: expect fun get ( url: String, params: Map<String, String>? = mapOf(“1” to “1"), headers: Map<String, String>? ) : Map<String, *>
m

megamiun

03/08/2018, 5:39 AM
Sorry, I didn't understand very much why this could cause problems. Could I ask you how?
a

albertgao

03/08/2018, 10:48 AM
If I can’t set the default value, then for some cases, I always needs to pass the explicitly. Which is verbose.