title: How to access Switch argument inside a case in Dart
body: <p>I want to switch on animals and take the appropriate action.</p>
  
  <pre><code>switch (animal.runtimeType) {
    case Cat:
      animal.pet();
      break;
    case Crocodile:
      animal.runAway();
      break;
    default:
      print('Not a known animal.');
  } 
  </code></pre>
  
  <p>If I were if-chaining this would work, since the scope would know the type of <code>animal</code> in the <code>if (animal is Cat){}</code> block.</p>
  
  <p>For some reason this is not the case with switch statements.
  In this case I will get the error</p>
  
  <p><code>The method pet() isn't defined for the class animal</code></p>
  
  <p>How can I use the case assertion in the case block?
  I cant use <code>as</code> since my CI Lint won't allow it (which is a good thing) and it makes no sense to use an If operation inside the case, since using a if-else statement would be less code and offer more usability.</p>