I\'m a bit kotlin newbie and I\'m trying to remove the callback instance inside the callback itself.
What I\'m trying to achieve it\'s something similar to the follo
There's also a workaround: wrap the reference to myCallback into a lambda passed to a function that calls it (e.g. run { ... }):
myCallback
private val myCallback: SomeInterfaceType = SomeInterfaceType { if (it.something) { someObject.removeListener(run { myCallback }) } }