Those kotlin handy extensions, Retrofit meet Kotlin and Result — part 2

Alejandro Moya
1 min readOct 9, 2019

--

So, After a while using the extension, seeing that it was really useful to me, hoping it is useful to other devs out there, i needed to do the sync part of it, this part is more like a little extension of the original, an extension of the extension if you like (not really but let’s play with the word).

Retrofit allows us to make calls asynchronously and synchronously, we always use the async way to avoid blocking the UI thread, but what about making a call on another thread already. We don’t want to create a chain of threads, we will try to keep everything in the same place, for this scenario, if we still want to make a call and receive our precious Result<T> we have this new extension:

Quite simple huh?!.

Please let me know if you use this or my other extensions, it makes me happy to share these.

--

--

Alejandro Moya

Mobile developer, Father, geek, this is my first attempt at having a blog, be kind 😄