title: Dart typecasting error
body: <p>I have an abstract class <code>Event</code> and a concrete subclass that extends it called <code>PlaceChangeEvent</code>. Inside an event listener, I have the following code:</p>
  
  <pre><code>void onEvent(Event event) {
      PlaceChangeEvent pce = null;
      if(event is PlaceChangeEvent)
          pce = (PlaceChangeEvent)event;      // &lt;== error is here
      else
          throw new Exception("Event is not a PlaceChangeEvent.");
  
      Place place = pce.place;
  
      presenterProvider.display(place);
  }
  </code></pre>
  
  <p>So if the runtime type of <code>event</code> is <code>PlaceChangeEvent</code>, then I need to cast the event to that type so that I can access its properties. But I'm getting a compiler error on the typecast, stating:</p>
  
  <blockquote>
    <p>A value of type 'Type' cannot be assigned to a variable of type 'PlaceChangeEvent'</p>
  </blockquote>
  
  <p>Where am I going wrong, and what do I need to do to fix it?</p>