I am trying to understand how the switch is working in the dart. I have very simple code:
methodname(num radians) {
switch (radians) {
case 0:
// do something
break;
case PI:
// do something else
break;
}
}
This unfortunately does not work. If left like this the error is: case expressions must have the same type (I think the type is num, but not the editor). If I change 0 to 0.0 it says: The switch type expression double cannot override == operator - I have no idea what this means!
So what is the way to do this switch case? I can turn it onto if/else probably but I wanted to know how to make the switch work and why is it not working in the first place.
I am running the latest stable version of DartEditor.