AndroidBites: That’s how we try-catch ?: Value

An elegant way of error handling using expressions and null-handing

tryOrNull | Androidbites | Kotlin

Taking inspiration from getOrNull type function in Kotlin, I ended up creating this extension which has helped me out in multiple cases, Specially dealings with JsonParsing .

Highly recommend the following extended explanation of how this extension work, Do checkout and stay tuned for more content.

Happy Hacking!

follow me on social media :
LinkedIn : https://bit.ly/ch8n-linkdIn
Medium: https://bit.ly/ch8n-medium
Twitter: https://bit.ly/ch8n-twitter
Blog: https://chetangupta.net
Github: https://bit.ly/ch8n-git
Youtube: https://bit.ly/ch8n-youtube

Coding enthusiast! love Android #kotlinAlltheWay, want to explore all opportunity around it! CodingMantra: #cleanCoder #TDD #SOLID #designpatterns

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store