title: how to fix flutter exception : Navigator operation requested with a context that does not include a Navigator
body: <p>I am trying to create a drawer navigation using flutter framework, 
  but i am getting the following exception every time I run it </p>
  
  <blockquote>
    <p>Another exception was thrown: Navigator operation requested with a
    context that does not include a Navigator.</p>
  </blockquote>
  
  <p>so what is the solution, any help ?</p>
  
  <p>I used Navigator class as the following </p>
  
  <pre><code>void main() {
    runApp(new MyApp());
  }
  
  class MyApp extends StatefulWidget {
    @override
    State&lt;StatefulWidget&gt; createState() {
      // TODO: implement createState
      return new AppStates();
    }
  }
  
  class AppStates extends State&lt;MyApp&gt; {
    @override
    Widget build(BuildContext context) {
      // TODO: implement build
  
      return MaterialApp(
        home: new Scaffold(
          appBar: AppBar(
            title: Text("Application App Bar"),
          ),
          drawer: Drawer(
            child: ListView(
              children: &lt;Widget&gt;[
                ListTile(
                  title: Text("Next Page"),
                  onTap: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (context) =&gt; NextPage()));
                  },
                )
              ],
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>and the code of the NextPage class is </p>
  
  <pre><code>class NextPage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      // TODO: implement build
      return MaterialApp(
        home: new Scaffold(
          appBar: new AppBar(
            title: new Text("Next Page App Bar"),
          ),
        ),
      );
    }
  }
  </code></pre>