title: Flutter delayed function called twice
body: <p>I have a launcher screen where I check do I have specific data or not. Depending on the result I show different screens</p>
  
  <pre><code> void main() =&gt; runApp(MyApp());
  
  
   class MyApp extends StatelessWidget {
     @override
      Widget build(BuildContext context) {
      return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: LauncherScreen()
    );
   }
  }
  
  
   class LauncherScreen extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
   print("build, build");
   Future.delayed(new Duration(milliseconds: 2000), () {
    LocalData localData = LocalData();
    localData.getCity().then((city) {
      if (city != null) {
        Const.city = city;
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) =&gt; Home()),
        );
      } else {
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) =&gt; SelectCities()),
        );
      }
    });
  });
  return Container(
      width: double.infinity,
      height: double.infinity,
       color: Color(GoEngColors.violet));
   }
  }
  </code></pre>
  
  <p>My <code>LauncherScreen</code> called twice and as a result, I see my <code>Home</code> or <code>Select city</code> screen appears twice.</p>
  
  <p>What is the reason of such behaviour and how to solve it? Thanks.</p>