title: Flutter Navigator operation requested with a context that does not include a Navigator. on splash screen
body: <p>so I'm trying to implement a splash screen where for two reasons.</p>
  <ol>
  <li>the time given to the splash screen will be used to load all the data</li>
  <li>For beautification</li>
  </ol>
  <p>I'm using <a href="https://pub.dev/packages/flutter_spinkit" rel="nofollow noreferrer">flutter_spinkit</a>
  So here's my code:</p>
  <pre><code>class _SplashScreenState extends State&lt;SplashScreen&gt; {
  
    void initState() {
      super.initState();
      navigateToHomeScreen();
    }
  
    Future navigateToHomeScreen() async {
      return Timer(
        const Duration(milliseconds: 4000),
        () {
          Navigator.pushReplacement(context,
              MaterialPageRoute(builder: (BuildContext context) =&gt; App())); ---&gt; doesn't go to new screen
        },
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          backgroundColor: Color(0xff75c760),
          body: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              _buildAppName(),
              SizedBox(height: 20),
              _buildSpinner(),
            ],
          ),
        ),
      );
    }
  
    Widget _buildAppName() {
      return Text(
        &quot;MasterChef&quot;,
        style: GoogleFonts.robotoMono(
          color: Colors.black,
          fontStyle: FontStyle.normal,
          fontSize: 30,
          fontWeight: FontWeight.bold,
        ),
      );
    }
  
    Widget _buildSpinner() {
      return SpinKitDoubleBounce(
        color: Colors.white,
      );
    }
  }
  </code></pre>
  <p>and here's the <code>App()</code> from <code>app.dart</code>:</p>
  <pre><code>class _AppState extends State&lt;App&gt; {
    //Contains the simple drawer with switch case for navigation
    //Taken directly from the flutter docs
  }
  </code></pre>
  <p>The basic idea is to load the splash screen for 4000 milliseconds in which the app will load all the necessary data and then navigate to App() which contains the navigation routes and all. But for some reason I'm getting <code>Unhandled Exception: Navigator operation requested with a context that does not include a Navigator.</code></p>