Using Picasso in Kotlin

Caching images in android is key for performance issues. We can write our own AsyncTask to manage it well or use Picasso with one-line of code:

When we develop our app in Kotlin we can make it smarter using Extension Properties.

Let’s create a new file inside our utils package, call it picasso.kt and fill it with simple code below:

While this corresponds to the receiver object we can invoke following code on any Context:

We can go further and extend ImageView class like:

Now call might look really nice: