title: Error : 'package:flutter/src/widgets/media_query.dart': Failed assertion: line 715 pos 12: 'context != null': is not true
body: <p>The problem is when I used mediaquery.of(context).size the  error appears only in this specific external method.</p>
  
  <p>I used the mediaquery in another class and it work successful and i tried to add context parameter in method but the error is not gone.</p>
  
  <p>Error found:</p>
  
  <blockquote>
    <p>I/flutter (24468): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY
    ╞═══════════════════════════════════════════════════════════ I/flutter
    (24468): The following assertion was thrown building Home(dirty,
    dependencies: [MediaQuery], state:</p>
    
    <p>I/flutter (24468): HomeState#c4bef):</p>
    
    <p>I/flutter (24468): 'package:flutter/src/widgets/media_query.dart':
    Failed assertion: line 715 pos 12: 'context !=</p>
    
    <p>I/flutter (24468): null': is not true.</p>
    
    <p>I/flutter (24468): I/flutter (24468): Either the assertion indicates
    an error in the framework itself, or we should provide substantially</p>
    
    <p>I/flutter (24468): more information in this error message to help you
    determine and fix the underlying cause.</p>
    
    <p>I/flutter (24468): In either case, please report this assertion by
    filing a bug on GitHub:</p>
    
    <p>I/flutter (24468):<br>
    <a href="https://github.com/flutter/flutter/issues/new?template=BUG.md" rel="nofollow noreferrer">https://github.com/flutter/flutter/issues/new?template=BUG.md</a></p>
    
    <p>I/flutter (24468):</p>
    
    <p>I/flutter (24468): User-created ancestor of the error-causing widget
    was:</p>
    
    <p>I/flutter (24468):   Container</p>
  </blockquote>
  
  <p>the code: </p>
  
  <pre><code>Widget slide() {
      return Container(
          height:  MediaQuery.of(context).size.width / 4,
          width: MediaQuery.of(context).size.width *1,
          child: Carousel(
            dotSize: 5,
            showIndicator: false,
            autoplay: true,
            images: [
              ExactAssetImage("images/01.jpg"),
              ExactAssetImage("images/02.jpg"),
              ExactAssetImage('images/03.jpg'),
              ExactAssetImage("images/04.jpg"),
              ExactAssetImage("images/05.jpg"),
              ExactAssetImage('images/06.jpg')
            ],
          ));
    }
  </code></pre>