I feel like this is a stupid question, but I cant get it to work.
What I have:
if (current is classA){
//do stuff
return;
}
if (current is classB){
//do stuff
return;
}
if (current is classC){
//do stuff
return;
}
What I want:
switch (currentState) {
case is classA: {
//do stuff
break;
}
case is classB: {
//do stuff
break;
}
case is classC: {
//do stuff
break;
}
}
What I really want (Kotlin):
When (currentState){
is classA -> //do stuff
is classB -> //do stuff
is classC -> //do stuff
}
Is there anyway I can use the Dart Switch like the Kotlins When operator, or at least use other operators then == to assert the case evaluations?