title: Flutter - Create a countdown widget
body: <p>I am trying to build a countdown widget. Currently, I got the structure to work. I only struggle with the countdown itself. I tried this approach using the countdown plugin:</p>
  
  <pre><code>class _Countdown extends State&lt;Countdown&gt; {
  
    int val = 3;
  
    void countdown(){
      CountDown cd = new CountDown(new Duration(seconds: 4));
  
      cd.stream.listen((Duration d) {
        setState((){
          val = d.inSeconds;
        });
      });
  
    }
  
    @override
    build(BuildContext context){
      countdown();
      return new Scaffold(
        body: new Container(
          child: new Center(
            child: new Text(val.toString(), style: new TextStyle(fontSize: 150.0)),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>However, the value changes very weirdly and not smooth at all. It start twitching. Any other approach or fixes?</p>