title: Smart cast (automatic type promotion) using 'is' is not working
body: <p>I'm using the Bloc pattern and have the following code to define my states:</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'package:meta/meta.dart'
  
  @immutable
  abstract class UiState {}
  
  class Loading extends UiState {}
  
  class Success extends UiState {
    Success(this.message);
  
    final String message;
  }
  
  class Failure extends UiState {}
  </code></pre>
  
  <p>I try to use a <code>UiState</code> as follows:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class MyWidget extends StatelessWidget {
    const MyWidget({
      Key key,
      @required this.uiState,
    }) : super(key: key);
  
    final UiState uiState;
  
    Widget build(BuildContext context) {
      if (uiState is Success) {
        return Text(uiState.message);
      }
      ...
    }
  }
  </code></pre>
  
  <p>But VSCode tells me that "The getter 'message' isn't defined for the class 'UiState'".</p>
  
  <p>I've used smart casts before and they did work. But in this instance, I'm not able to figure out why it's not working.</p>
  
  <p>My pubspec has the following:</p>
  
  <pre><code>environment:
    sdk: "&gt;=2.1.0 &lt;3.0.0"
  </code></pre>
  
  <p>So, I assume my dart version is atleast 2.1.0.</p>