In Kotlin I would like to create a lambda that takes no parameters and returns nothing. I know how to do this when it takes a string parameter and returns nothing:
private var mOnTextWatcherCallback: ((m: String) -> Unit)? = null
But how do I do it for no parameters?
Just use empty parentheses:
private var mOnTextWatcherCallback: (() -> Unit)? = null
// ^^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With