I'm getting below error while compiling:
Type mismatch: inferred type is (String, Boolean) -> Any but ((String, Boolean) -> Unit)? was expected
My Type Declaration is
private val ConsisFilter_Click = { filterText: String, isStrictSearch: Boolean ->
try {
//My Codes
}
catch (e: Exception) {
try {
alert{}.show()
}catch (ignored: Exception) {}
}
}
var ConsisFilterClickEvent:((filterText: String, isStrictSearch: Boolean) -> Unit)? = null
assigninkg like this
inputDialog!!.ConsisFilterClickEvent = ConsisFilter_Click
I'm following same pattern elsewhere but not getting any error. Only this particular piece is giving problem. Am I doing something wrong. Please help me.
NOTE: If I put all codes of ConsisFilter_Click
(code of try catch block) into a separate function and simply call that function from ConsisFilter_Click
then every this works well
Thanks