Hey guys, checkout this solid article on how to im...
# android
c
Hey guys, checkout this solid article on how to implement retrofit request calls using coroutines. I can already see this making my life so much easier 👌 https://proandroiddev.com/suspend-what-youre-doing-retrofit-has-now-coroutines-support-c65bd09ba067 However, if you've read the above article, it eliminates the callbacks methods onResponse & onFailure. And while onFailure is mostly for http response errors, in my onResponse method, my standard logic to write code is like this..
Copy code
override fun onResponse(call: Call<T>, response: Response<T>){
    if(response.isSuccessful){
        // Do something meaningful logic
    } else {
        // Do some Logic which handles the error
    }

    override onFailure(call: Call<T>, t: Throwable){
        // Handle Logs
    }
Now that these two callbacks are gone, as you know if you've read the article above, how do I handle the if(response.isSuccessful) { //DO THIS } else { //DO THAT } Logic? Any Ideas? (P.S. A better understanding of my question will be possible after reading the article mentioned below)
👍 2