Issue
I'm trying to call a lambda from another lambda in this way:
fun fetch(
onSuccess: (result: Any, onSet: () -> Unit) -> Unit
) {
remoteConfigInstance.fetchAndActivate()
.addOnCompleteListener { task ->
if (task.isSuccessful) onSuccess(task.result, ()) // <- Here is the issue
}
}
I get an error trying to call the onSet
lambda like this. Is there a correct approach to solve this problem?
Solution
the problem is simply that ()
is not a lambda. Replace it with {}
Answered By - Ivo Beckers
Answer Checked By - Katrina (JavaFixing Volunteer)