IbrahimAbousalem
10/10/2021, 7:05 PMsealed class States{
object Loading:States()
data Success(val data: String):States()
}
results.filter{
it.state is States.Success
}.forEach{ successState ->
println(successState.data) //Error since this still State not Success State
}
Joffrey
10/10/2021, 7:07 PMfilterIsInstance<States.Success>()
instead of a classic filter
to have the correct type down the lineIbrahimAbousalem
10/10/2021, 7:18 PM