Alessandro Mautone
1 min readOct 28, 2019


Instead of returning

Either<Failure, List<User>>

in the UseCase, why not just return


(I would rename it to FriendsResult or something similar) and return the error as a type of the sealed class? Like:

sealed class FriendsState {        
object Loading : FriendsState()
object Empty : FriendsState()
data class Success(val users: List<UserUiModel>) :FriendsState()
object Error : FriendsState()




Alessandro Mautone

Android Lead Engineer @Canyon 🤖 🇻🇪🇮🇹 Paraglider, Runner, Kayaker.