In the following excerpt ``` private val dashItemI...
# getting-started
g
In the following excerpt
Copy code
private val dashItemInterface: DashItemInterface = object : DashItemInterface {
    override fun onClick(item: DashItem) {
        item.foo()
    }
}
The IDE suggests to convert it to a lambda, however when I set it like that:
Copy code
private val dashItemInferface: DashItemInterface = { item: DashItem -> item.foo() }
It signals as a type mismatch, saying it was expecting an instance of an implementation of the interface rather than a
(DashItem) -> Unit
. Am I doing it wrong somehow?
d
Try,
private val dashItemInferface = DashItemInterface { it.foo() }
.
g
Aaaah that appears to work, building