title: How do I create an animated number counter?
body: <p>I'd like to create a number counter that animates from a starting value to an end value. I've looked into using a Timer but can't seem to animate/update state properly. Including the decimal value would be great, but a simple integer animation is fine.</p>
  
  <p><a href="https://i.stack.imgur.com/FCcvo.png" rel="noreferrer">Number counter that needs to animate</a></p>
  
  <pre><code>double _mileCounter = 643.6;
  
  _animateMileCounter() {
    Duration duration = new Duration(milliseconds: 300);
    return new Timer(duration, _updateMileCounter);
  }
  
  _updateMileCounter() {
    setState(() {
      _mileCounter += 1;
    });
  }
  </code></pre>
  
  <p>How would I increment the counter X number of times (with animation)? Similar to how a car's odometer increments.</p>