Pass null value when method declaration creates an empty map - input: Map<String, String> = emptyMap() in the interface - Kotlin
I have an interface with following declaration.
interface makeItHappenInterface {
fun methodOne(params: Map = emptyMap()):Boolean
}
I want to call this method but the params sometimes could be null.
....
var extraDtls = calculate(val1, val2)
makeItHappenImpl.methodOne(extraDtls)
// error in above line saying ----
Type mismatch.
Required:
Map
Found:
Map?
so how to handle above error? should I change the method declaration in interface? or any other technique to fix this...