title: How to stop the timer in flutter?
body: <p>I have created a timer in flutter and everything works fine. Now I can't figure out how to dismiss the timer after I started it.<br />
  The docs say that you can cancel it by calling <code>void cancel()</code> but I don't understand the implementation.</p>
  <p>How am I supposed to call it?<br />
  And is it the right approach?</p>
  <pre><code>  static const timeout = const Duration(seconds: 5);
    static const ms = const Duration(milliseconds: 1);
  
    startTimeout([int milliseconds]) {
      var duration = milliseconds == null ? timeout : ms * milliseconds;
      return new Timer(duration, handleTimeout);
    }
  
    void handleTimeout() {  // callback function
      Navigator.of(context).pushAndRemoveUntil(new MaterialPageRoute(
          builder: (BuildContext context) =&gt; new ScorePage(quiz.score, quiz.length)),(Route route) =&gt; route == null);
      return;
    }
  </code></pre>