Instead of returning

Either<Failure, List<User>>

in the UseCase, why not just return

FriendsState

(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()
}

?

Senior Android Engineer @WeTransfer 🤖 🇻🇪🇮🇹 Paraglider, Runner, Kayaker.

Senior Android Engineer @WeTransfer 🤖 🇻🇪🇮🇹 Paraglider, Runner, Kayaker.