Abhinay Gupta
Mar 20, 2024

--

Thank you for the detailed article. But I believe your example for the sealed class can be used for the sealed interface since there are no constructors required.

The example showed for the sealed interface has no advantages over the normal interface

sealed interface ViewState {

object Loading : ViewState

data class Success(val data: List<Item>) : ViewState data class Error(val message: String) : ViewState

}

--

--

Abhinay Gupta
Abhinay Gupta

Written by Abhinay Gupta

Exploring personal growth, tech, and culture through engaging storytelling | Inspiring and connecting with readers worldwide.

No responses yet