An introduction to Kotlin Sealed Class
Sealed classes are a special kind of class in Kotlin, used to create restricted hierachies — where the full list of sub-classes is strictly limited, and known in advance. This is particularly useful when we want to enhance the power of Kotlin’s when statement, model a type that has a fixed set of possible variations, or represent a fixed group of states or outcomes (such as network responses, UI states and form validations).