title: flutter run function every x amount of seconds
body: <p>inside my flutter app I want to check my api every 10 seconds. I found <a href="https://stackoverflow.com/questions/14946012/how-do-i-run-a-reoccurring-function-in-dart">this post</a> to run a function every x amount of time and did the following:</p>
  
  <pre><code>class _MainPage extends State&lt;MainPage&gt; {
    int starter = 0;
  
    void checkForNewSharedLists(){
      // do request here
      setState((){
        // change state according to result of request
      });
  
    }
  
    Widget build(BuildContext context) {
      Timer.periodic(Duration(seconds: 15), (Timer t) =&gt; checkForNewSharedLists());
    }
  } 
  </code></pre>
  
  <p>Unfortunately the requests pile up: after restarting the app on the first "round" there are two request to the api, the second round it's four requests, the third it's eight and so on...</p>
  
  <p>Does anybody know how to fix this?</p>