title: Switch fallthrough in Dart
body: <p>I started learning Dart today, and I've come across something that my google skills are having trouble finding.</p>
  
  <p>How do I have a fall-through in a non-empty case?</p>
  
  <p>My use case is this: I'm writing a sprintf implementation (since dart doesn't have this too), which would work except for this fall-through thing. When parsing the variable type you can, for example, have "%x" versus "%X" where the upper case type tells the formatter that the output is supposed to be uppercase. </p>
  
  <p>The semi-pseudocode looks like:</p>
  
  
  
  <pre class="lang-dart prettyprint-override"><code>bool is_upper = false;
  switch (getType()) {
      case 'X':
        is_upper = true;
      case 'x':
        return formatHex(is_upper);
  }
  </code></pre>
  
  <p>The other ways I can think of doing this, would one of the following</p>
  
  <p>1:</p>
  
  <pre class="lang-dart prettyprint-override"><code>switch (getType()) {
    case 'X': case 'x':
      return formatHex('X' == getType());
  }
  </code></pre>
  
  <p>2:</p>
  
  <pre class="lang-dart prettyprint-override"><code>var type = getType();
  if (type in ['x', 'X']) {
     return formatHex('X' == getType());
  }
  </code></pre>
  
  <p>Now, the second choice almost looks good, but then you have to remember that there are eleven cases, which would mean having eleven <code>if (type in [])</code>, which is more typing that I'd like.</p>
  
  <p>So, does dart have some <code>// //$FALL-THROUGH$</code> that I don't know about?</p>
  
  <p>Thanks.</p>