title: How do use a Switch Case Statement in Dart
body: <p>I am trying to understand how the switch is working in the dart. I have very simple code:</p>
  <pre class="lang-dart prettyprint-override"><code>methodname(num radians) {
    switch (radians) {
      case 0:
        // do something
        break;
      case PI:
        // do something else
        break;
    }
  }
  </code></pre>
  <p>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!</p>
  <p>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.</p>
  <p>I am running the latest stable version of DartEditor.</p>