Kotlin has a very decent null-safety baked in; and even better, it is a part of its type system. private fun easy1(str: String?): String { return str?.let { return "$str is so easy" } ?: "Not so easy after all" } // We can easily ca...

Markdown supported · ⌘↵ to post
Ryan Hintze
Android Software Engineer. Lover of Kotlin.
Enjoyed the article! What do you think of using contracts for nullable values instead of using the result of
bind? I can only think that this might cause some issues if a background thread or value read changes the value. I implemented a PoC here:https:// github .com/spyderrsh/extending-kotlin-null-safetly/commit/40fc29336725f2e4c7fdd353c062973405a356a6
(Sorry, new user, so I had to add spaces in my link)