In retrofit2, Callabck just means that it goes back to
override fun onResponse(call: Call<List<Photos?>?>, response: Response<List<Photos?>?>) {
if it is successful and I see the dataclass fully populated. What is the most elegant way of handling on Response?
SHould I pass an object in the constructor to say call a method on the passed object to populate the data?
a
Alejandro Rios
06/03/2020, 12:25 PM
what about creating a sealed class to handle the
Success
and
Failure
cases?
Alejandro Rios
06/03/2020, 12:27 PM
Copy code
sealed class Result {
data class Success(val data : List<Photos>) : Result()
data class Failure(val exception : String) : Result()
}