title: NoSuchMethodError: The method 'ancestorStateOfType' was called on null
body: <p>i am doing screen change like this iam listing for stream and when it emit i change the screen</p>
  
  <pre><code> @override
   void initState() {
      super.initState();
  
       appBloc.error.listen((data) {
       _scaffoldKey.currentState.showSnackBar(new SnackBar(content: new 
          Text(data)));
      });
  
       appBloc.success.listen((_) =&gt; goToDashBoardScreen(context));
  
  }
  </code></pre>
  
  <p>and doToDashBoardScreen look like this</p>
  
  <pre><code>Navigator.pushReplacement(context, new SlideRightRoute(widget: 
  DashBoardScreen()));
  </code></pre>
  
  <p>but i am getting error like this but i change the page.</p>
  
  <pre><code>22:05:02.446 3 info flutter.tools E/flutter (13216): NoSuchMethodError: 
  The method 'ancestorStateOfType' was called on null.
  22:05:02.446 4 info flutter.tools E/flutter (13216): Receiver: null
  22:05:02.446 5 info flutter.tools E/flutter (13216): Tried calling: 
  ancestorStateOfType(Instance of 'TypeMatcher&lt;NavigatorState&gt;')
  22:05:02.446 6 info flutter.tools E/flutter (13216): #0      
  Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
  22:05:02.446 7 info flutter.tools E/flutter (13216): #1      
  Navigator.of (package:flutter/src/widgets/navigator.dart:1270:19)
  22:05:02.446 8 info flutter.tools E/flutter (13216): #2      
  Navigator.pushReplacement 
  (package:flutter/src/widgets/navigator.dart:952:22)
  </code></pre>